This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients ajaksu2, garth42, giampaolo.rodola, gvanrossum, intgr, johnjsmith, josiahcarlson, klimkin, vstinner, yselivanov
Date 2014-06-27.22:40:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403908849.7.0.724796065047.issue777588@psf.upfronthosting.co.za>
In-reply-to
Content
"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.rodola@gmail.com>
date:        Wed Aug 04 09:04:53 2010 +0000
files:       Lib/asyncore.py Misc/ACKS Misc/NEWS
description:
Merged revisions 83705 via svnmerge from
svn+ssh://pythondev@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 +0000
+++ b/Lib/asyncore.py   Wed Aug 04 09:04:53 2010 +0000
@@ -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:
...
---
History
Date User Action Args
2014-06-27 22:40:49vstinnersetrecipients: + vstinner, gvanrossum, josiahcarlson, klimkin, garth42, johnjsmith, giampaolo.rodola, ajaksu2, intgr, yselivanov
2014-06-27 22:40:49vstinnersetmessageid: <1403908849.7.0.724796065047.issue777588@psf.upfronthosting.co.za>
2014-06-27 22:40:49vstinnerlinkissue777588 messages
2014-06-27 22:40:49vstinnercreate