From: Giampaolo Rodolà Date: Wed, 4 Aug 2010 09:02:27 +0000 (+0000) Subject: fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexa... X-Git-Tag: v3.2a2~479 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=934abddaece303fce61e1ab3bb3c631c30f117c2;p=thirdparty%2FPython%2Fcpython.git fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexander Shigin). Merged from 2.7 branch. --- diff --git a/Lib/asyncore.py b/Lib/asyncore.py index fba55e0d8951..874f101681aa 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -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: diff --git a/Misc/ACKS b/Misc/ACKS index 75c3ae7b30ec..bb00e0fcf714 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -895,3 +895,4 @@ Siebren van der Zee Uwe Zessin Tarek Ziadé Peter Åstrand +Alexander Shigin diff --git a/Misc/NEWS b/Misc/NEWS index fcd450be0372..f051eb4465a1 100644 --- 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.