diff --git a/src/upnp.py b/src/upnp.py index 6aef00a6..47706637 100644 --- a/src/upnp.py +++ b/src/upnp.py @@ -114,6 +114,7 @@ class Router: self.localAddress = s.getsockname()[0] logger.debug("Local IP: %s", self.localAddress) try: + s.shutdown(socket.SHUT.RDWR) s.close() except: pass @@ -211,6 +212,7 @@ class uPnPThread(threading.Thread, StoppableThread): for router in self.routers: if router.extPort is None: self.createPortMapping(router) + self.sock.shutdown(socket.SHUT.RDWR) self.sock.close() for router in self.routers: if router.extPort is not None: