Invalid fd are < 0, not only -1

This commit is contained in:
nemunaire 2015-09-12 14:35:40 +02:00
parent beeb5573e1
commit 9fa8902f1a

View file

@ -138,17 +138,17 @@ class Bot(threading.Thread):
fnd_smth = False fnd_smth = False
# Looking for invalid server # Looking for invalid server
for r in _rlist: for r in _rlist:
if not hasattr(r, "fileno") or not isinstance(r.fileno(), int) or r.fileno() == -1: if not hasattr(r, "fileno") or not isinstance(r.fileno(), int) or r.fileno() < 0:
_rlist.remove(r) _rlist.remove(r)
logger.error("Found invalid object in _rlist: " + r) logger.error("Found invalid object in _rlist: " + r)
fnd_smth = True fnd_smth = True
for w in _wlist: for w in _wlist:
if not hasattr(w, "fileno") or not isinstance(w.fileno(), int) or w.fileno() == -1: if not hasattr(w, "fileno") or not isinstance(w.fileno(), int) or w.fileno() < 0:
_wlist.remove(w) _wlist.remove(w)
logger.error("Found invalid object in _wlist: " + w) logger.error("Found invalid object in _wlist: " + w)
fnd_smth = True fnd_smth = True
for x in _xlist: for x in _xlist:
if not hasattr(x, "fileno") or not isinstance(x.fileno(), int) or x.fileno() == -1: if not hasattr(x, "fileno") or not isinstance(x.fileno(), int) or x.fileno() < 0:
_xlist.remove(x) _xlist.remove(x)
logger.error("Found invalid object in _xlist: " + x) logger.error("Found invalid object in _xlist: " + x)
fnd_smth = True fnd_smth = True