]> granicus.if.org Git - python/commitdiff
Merged revisions 83705 via svnmerge from
authorGiampaolo Rodolà <g.rodola@gmail.com>
Wed, 4 Aug 2010 09:04:53 +0000 (09:04 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Wed, 4 Aug 2010 09:04:53 +0000 (09:04 +0000)
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.
........

Lib/asyncore.py
Misc/ACKS
Misc/NEWS

index f066e769c8828ac1618c34e7e6215869557720b6..7b922a98cc06a70fc3bf3822016ec5a2f4a8f7ad 100644 (file)
@@ -426,8 +426,11 @@ class dispatcher:
             self.handle_read()
 
     def handle_connect_event(self):
-        self.connected = True
+        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
 
     def handle_write_event(self):
         if self.accepting:
index 6486e794ca63fc43fc39b0bbe8db93e78f176e6b..15c0aedf998f319d9b0db4feaf3a275f69c139da 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -856,3 +856,4 @@ Uwe Zessin
 Tarek Ziadé
 Peter Åstrand
 Fredrik Håård
+Alexander Shigin
index 262bd5e054ed42a99462334e01ee7364258cf4bf..5eb967228e2e4395db7bc5e8501be5f3f941ea39 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -84,6 +84,8 @@ C-API
 Library
 -------
 
+- Issue #2944: asyncore doesn't handle connection refused correctly.
+
 - Issue #3196: email header decoding is now forgiving if an RFC2047
   encoded word encoded in base64 is lacking padding.