Fix check for wrong named attributes
This commit is contained in:
parent
9359aa0688
commit
1c039389f2
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue