[issue777588] asyncore/Windows: select() doesn't report errors for a non-blocking connect()

2014-06-27 Thread STINNER Victor

STINNER Victor added the comment:

Workaround: (...)
e = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)

Oh, it looks like the issue was already fixed 4 years ago:
---
changeset:   63720:ba7353147507
branch:  3.1
parent:  63716:915b028b954d
user:Giampaolo RodolĂ  g.rod...@gmail.com
date:Wed Aug 04 09:04:53 2010 +
files:   Lib/asyncore.py Misc/ACKS Misc/NEWS
description:
Merged revisions 83705 via svnmerge from
svn+ssh://python...@svn.python.org/python/branches/py3k


  r83705 | giampaolo.rodola | 2010-08-04 11:02:27 +0200 (mer, 04 ago 2010) | 1 
line

  fix issue #2944: asyncore doesn't handle connection refused correctly (patch 
by Alexander Shigin). Merged from 2.7 branch.



diff -r 915b028b954d -r ba7353147507 Lib/asyncore.py
--- a/Lib/asyncore.py   Wed Aug 04 04:53:07 2010 +
+++ b/Lib/asyncore.py   Wed Aug 04 09:04:53 2010 +
@@ -426,8 +426,11 @@ class dispatcher:
 self.handle_read()
 
 def handle_connect_event(self):
+err = self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
+if err != 0:
+raise socket.error(err, _strerror(err))
+self.handle_connect()
 self.connected = True
-self.handle_connect()
 
 def handle_write_event(self):
 if self.accepting:
...
---

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue777588
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue777588] asyncore/Windows: select() doesn't report errors for a non-blocking connect()

2014-06-27 Thread STINNER Victor

STINNER Victor added the comment:

Note: asyncio also calls getsockopt(SOL_SOCKET,SO_ERROR) to check if the 
connect() succeeded or not, and so it doesn't have this bug.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue777588
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue777588] asyncore/Windows: select() doesn't report errors for a non-blocking connect()

2014-06-06 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: asyncore is broken for windows if connection is refused - 
asyncore/Windows: select() doesn't report errors for a non-blocking connect()

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue777588
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com