]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexa...
authorGiampaolo Rodolà <g.rodola@gmail.com>
Wed, 4 Aug 2010 09:02:27 +0000 (09:02 +0000)
committerGiampaolo Rodolà <g.rodola@gmail.com>
Wed, 4 Aug 2010 09:02:27 +0000 (09:02 +0000)
Lib/asyncore.py
Misc/ACKS
Misc/NEWS

index fba55e0d89515725ef37d750392a987302b63c46..874f101681aa433e0ea2ca70df5990ca9cbc917c 100644 (file)
@@ -435,8 +435,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 75c3ae7b30ec603248ac565e3eaf377390c93934..bb00e0fcf7143acf39eaf9f0e4a47d4f0e8c820c 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -895,3 +895,4 @@ Siebren van der Zee
 Uwe Zessin
 Tarek Ziadé
 Peter Åstrand
+Alexander Shigin
index fcd450be0372615bccdd8d5b2e1caee0c587337b..f051eb4465a11527c506a4e93188931760b70590 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,8 @@ Extensions
 Library
 -------
 
+- Issue #2944: asyncore doesn't handle connection refused correctly.
+
 - Issue #4184: Private attributes on smtpd.SMTPChannel made public and
   deprecate the private attributes. Add tests for smtpd module.