Fix check for wrong named attributes

This commit is contained in:
rprinz08 2020-11-07 11:13:51 +01:00
parent 9359aa0688
commit 1c039389f2
1 changed files with 2 additions and 2 deletions

View File

@ -18,13 +18,13 @@ class CommUDP:
self.debug = debug self.debug = debug
def open(self): def open(self):
if hasattr(self, "tx_socket"): if hasattr(self, "socket"):
return return
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.socket.bind(("", self.port)) self.socket.bind(("", self.port))
def close(self): def close(self):
if not hasattr(self, "tx_socket"): if not hasattr(self, "socket"):
return return
self.socket.close() self.socket.close()
del self.socket del self.socket