From 8c5ced43a127592585fede62f68edb4886804202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Giampaolo=20Rodol=C3=A0?= Date: Wed, 4 Aug 2010 09:04:53 +0000 Subject: [PATCH] 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. ........ --- Lib/asyncore.py | 5 ++++- Misc/ACKS | 1 + Misc/NEWS | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/asyncore.py b/Lib/asyncore.py index f066e769c88..7b922a98cc0 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -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: diff --git a/Misc/ACKS b/Misc/ACKS index 6486e794ca6..15c0aedf998 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -856,3 +856,4 @@ Uwe Zessin Tarek Ziadé Peter Åstrand Fredrik Håård +Alexander Shigin diff --git a/Misc/NEWS b/Misc/NEWS index 262bd5e054e..5eb967228e2 100644 --- 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.