Message17326
asyncore.poll is broken on windows. If a connection is
refused happens it will hang for ever and never raise
an exception.
The Select statment never checks the exfds. This is
needed as this is where windows reports failed
connections. The documentation in the microsoft
platform SDK mentions this.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/select_2.asp
The suggested fix is shown below althought this is
untested. The correct error number is recived from
getsockopt(SOL_SOCKET,SO_ERROR)
def poll(timeout=0.0, map=None):
if map is None:
map = socket_map
if map:
r = []; w = []; e = []
for fd, obj in map.items():
if obj.readable():
r.append(fd)
if obj.writable():
w.append(fd)
if sys.platform == 'win32':
if not obj.connected:
e.append(fd)
if [] == r == w == e:
time.sleep(timeout)
else:
try:
r, w, e = select.select(r, w, e, timeout)
except select.error, err:
if err[0] != EINTR:
raise
else:
return
if sys.platform == 'win32':
for fd in e:
obj = map.get(fd)
if obj is None:
continue
errno =
fs.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
raise
socket.error,(errno,socketerrorTab[error])
for fd in r:
obj = map.get(fd)
if obj is None:
continue
read(obj)
for fd in w:
obj = map.get(fd)
if obj is None:
continue
write(obj)
|
|
Date |
User |
Action |
Args |
2007-08-23 14:15:19 | admin | link | issue777588 messages |
2007-08-23 14:15:19 | admin | create | |
|