In poll(), check connections for exceptional conditions
This commit is contained in:
parent
88fcca6815
commit
0fff6c8651
|
@ -80,6 +80,14 @@ def write(obj):
|
||||||
except:
|
except:
|
||||||
obj.handle_error()
|
obj.handle_error()
|
||||||
|
|
||||||
|
def _exception (obj):
|
||||||
|
try:
|
||||||
|
obj.handle_expt_event()
|
||||||
|
except ExitNow:
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
obj.handle_error()
|
||||||
|
|
||||||
def readwrite(obj, flags):
|
def readwrite(obj, flags):
|
||||||
try:
|
try:
|
||||||
if flags & (select.POLLIN | select.POLLPRI):
|
if flags & (select.POLLIN | select.POLLPRI):
|
||||||
|
@ -99,6 +107,7 @@ def poll(timeout=0.0, map=None):
|
||||||
if map:
|
if map:
|
||||||
r = []; w = []; e = []
|
r = []; w = []; e = []
|
||||||
for fd, obj in map.items():
|
for fd, obj in map.items():
|
||||||
|
e.append(fd)
|
||||||
if obj.readable():
|
if obj.readable():
|
||||||
r.append(fd)
|
r.append(fd)
|
||||||
if obj.writable():
|
if obj.writable():
|
||||||
|
@ -126,6 +135,12 @@ def poll(timeout=0.0, map=None):
|
||||||
continue
|
continue
|
||||||
write(obj)
|
write(obj)
|
||||||
|
|
||||||
|
for fd in e:
|
||||||
|
obj = map.get(fd)
|
||||||
|
if obj is None:
|
||||||
|
continue
|
||||||
|
_exception(obj)
|
||||||
|
|
||||||
def poll2(timeout=0.0, map=None):
|
def poll2(timeout=0.0, map=None):
|
||||||
# Use the poll() support added to the select module in Python 2.0
|
# Use the poll() support added to the select module in Python 2.0
|
||||||
if map is None:
|
if map is None:
|
||||||
|
|
Loading…
Reference in New Issue