Don't call _open if it is not defined
This commit is contained in:
parent
5e097b5415
commit
0731803550
@ -64,7 +64,7 @@ class AbstractServer(io.IOBase):
|
|||||||
def open(self):
|
def open(self):
|
||||||
"""Generic open function that register the server un _rlist in case of successful _open"""
|
"""Generic open function that register the server un _rlist in case of successful _open"""
|
||||||
self.logger.info("Opening connection to %s", self.id)
|
self.logger.info("Opening connection to %s", self.id)
|
||||||
if self._open():
|
if not hasattr(self, "_open") or self._open():
|
||||||
_rlist.append(self)
|
_rlist.append(self)
|
||||||
_xlist.append(self)
|
_xlist.append(self)
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class AbstractServer(io.IOBase):
|
|||||||
def close(self):
|
def close(self):
|
||||||
"""Generic close function that register the server un _{r,w,x}list in case of successful _close"""
|
"""Generic close function that register the server un _{r,w,x}list in case of successful _close"""
|
||||||
self.logger.info("Closing connection to %s", self.id)
|
self.logger.info("Closing connection to %s", self.id)
|
||||||
if self._close():
|
if not hasattr(self, "_close") or self._close():
|
||||||
if self in _rlist:
|
if self in _rlist:
|
||||||
_rlist.remove(self)
|
_rlist.remove(self)
|
||||||
if self in _wlist:
|
if self in _wlist:
|
||||||
|
Loading…
Reference in New Issue
Block a user