handle join_group errors
This commit is contained in:
parent
040faedbf9
commit
28c01b5b31
2 changed files with 8 additions and 4 deletions
|
@ -37,7 +37,6 @@ class MulticastProtocol(DatagramProtocol):
|
||||||
|
|
||||||
def connection_made(self, transport) -> None:
|
def connection_made(self, transport) -> None:
|
||||||
self.transport = transport
|
self.transport = transport
|
||||||
self.join_group(self.multicast_address, self.bind_address)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_multicast_socket(cls, bind_address: str):
|
def create_multicast_socket(cls, bind_address: str):
|
||||||
|
|
|
@ -112,10 +112,15 @@ async def listen_ssdp(lan_address: str, gateway_address: str,
|
||||||
)
|
)
|
||||||
transport: DatagramTransport = listen_result[0]
|
transport: DatagramTransport = listen_result[0]
|
||||||
protocol: SSDPProtocol = listen_result[1]
|
protocol: SSDPProtocol = listen_result[1]
|
||||||
|
except Exception as err:
|
||||||
|
raise UPnPError(err)
|
||||||
|
try:
|
||||||
|
protocol.join_group(protocol.multicast_address, protocol.bind_address)
|
||||||
protocol.set_ttl(1)
|
protocol.set_ttl(1)
|
||||||
except Exception:
|
except Exception as err:
|
||||||
log.exception("failed to create multicast socket %s:%i", lan_address, SSDP_PORT)
|
transport.close()
|
||||||
raise
|
raise UPnPError(err)
|
||||||
|
|
||||||
return transport, protocol, gateway_address, lan_address
|
return transport, protocol, gateway_address, lan_address
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue