From: Giampaolo Rodolà Date: Wed, 4 Aug 2010 08:35:25 +0000 (+0000) Subject: fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexa... X-Git-Tag: v2.7.1rc1~467 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=47617ab20d290c99bebbb179db7c0b714b415c8c;p=python fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexander Shigin) --- diff --git a/Lib/asyncore.py b/Lib/asyncore.py index c23c8aa3fe..c3b9d76954 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 089939ee1e..e3aa41cf5e 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -871,3 +871,4 @@ Uwe Zessin Tarek Ziadé Peter Åstrand Andrej Krpic +Alexander Shigin diff --git a/Misc/NEWS b/Misc/NEWS index 545ef74f21..dd5252cce2 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -24,6 +24,8 @@ Core and Builtins 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.