fix
This commit is contained in:
parent
0c9ee7794e
commit
2581b79db5
2 changed files with 6 additions and 5 deletions
|
@ -30,16 +30,19 @@ class SSDPProtocol(MulticastProtocol):
|
||||||
man=man, mx=1
|
man=man, mx=1
|
||||||
)
|
)
|
||||||
log.debug("sending packet to %s:%i: %s", address, SSDP_PORT, packet)
|
log.debug("sending packet to %s:%i: %s", address, SSDP_PORT, packet)
|
||||||
|
print(packet.encode())
|
||||||
self.transport.sendto(packet.encode().encode(), (address, SSDP_PORT))
|
self.transport.sendto(packet.encode().encode(), (address, SSDP_PORT))
|
||||||
|
|
||||||
async def m_search(self, address, timeout: int = 1, service=UPNP_ORG_IGD) -> SSDPDatagram:
|
async def m_search(self, address, timeout: int = 1, service=UPNP_ORG_IGD) -> SSDPDatagram:
|
||||||
if (address, service) in self.discover_callbacks:
|
if (address, service) in self.discover_callbacks:
|
||||||
return self.discover_callbacks[(address, service)]
|
return self.discover_callbacks[(address, service)]
|
||||||
|
|
||||||
# D-Link, Cisco
|
# D-Link works with both
|
||||||
self.send_m_search_packet(service, address, "\"%s\"" % SSDP_DISCOVER)
|
|
||||||
|
|
||||||
# DD-WRT
|
# Cisco only works with quotes
|
||||||
|
self.send_m_search_packet(service, address, '"%s"' % SSDP_DISCOVER)
|
||||||
|
|
||||||
|
# DD-WRT only works without quotes
|
||||||
self.send_m_search_packet(service, address, SSDP_DISCOVER)
|
self.send_m_search_packet(service, address, SSDP_DISCOVER)
|
||||||
|
|
||||||
f: Future = Future()
|
f: Future = Future()
|
||||||
|
|
|
@ -112,8 +112,6 @@ class SSDPDatagram(object):
|
||||||
raise UPnPError("required field for {} is missing: {}".format(self._packet_type, attr_name))
|
raise UPnPError("required field for {} is missing: {}".format(self._packet_type, attr_name))
|
||||||
if attr_name == 'mx':
|
if attr_name == 'mx':
|
||||||
value = str(attr)
|
value = str(attr)
|
||||||
elif attr_name == 'man':
|
|
||||||
value = "\"%s\"" % attr
|
|
||||||
else:
|
else:
|
||||||
value = attr
|
value = attr
|
||||||
lines.append("{}: {}".format(attr_name.upper(), value))
|
lines.append("{}: {}".format(attr_name.upper(), value))
|
||||||
|
|
Loading…
Reference in a new issue