summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGiampaolo RodolĂ  <g.rodola@gmail.com>2010-08-04 09:02:27 (GMT)
committerGiampaolo RodolĂ  <g.rodola@gmail.com>2010-08-04 09:02:27 (GMT)
commit934abddaece303fce61e1ab3bb3c631c30f117c2 (patch)
treee6ca1c5253a8b1e2fd5a77f08b01fd2e9d50be4b /Lib
parent84c7d9f87b33282a84ef2bfc9ffe407aa9976243 (diff)
downloadcpython-934abddaece303fce61e1ab3bb3c631c30f117c2.zip
cpython-934abddaece303fce61e1ab3bb3c631c30f117c2.tar.gz
cpython-934abddaece303fce61e1ab3bb3c631c30f117c2.tar.bz2
fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexander Shigin). Merged from 2.7 branch.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/asyncore.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index fba55e0..874f101 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: