diff options
| author | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-04 08:35:25 (GMT) |
|---|---|---|
| committer | Giampaolo RodolĂ <g.rodola@gmail.com> | 2010-08-04 08:35:25 (GMT) |
| commit | 47617ab20d290c99bebbb179db7c0b714b415c8c (patch) | |
| tree | 2652e1ce8f2b4020c8332990a431a132cb6b831d /Lib/asyncore.py | |
| parent | 0b5019fe2376ed6ef2aaf61ff9cbc8e6b090bc56 (diff) | |
| download | cpython-47617ab20d290c99bebbb179db7c0b714b415c8c.zip cpython-47617ab20d290c99bebbb179db7c0b714b415c8c.tar.gz cpython-47617ab20d290c99bebbb179db7c0b714b415c8c.tar.bz2 | |
fix issue #2944: asyncore doesn't handle connection refused correctly (patch by Alexander Shigin)
Diffstat (limited to 'Lib/asyncore.py')
| -rw-r--r-- | Lib/asyncore.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/asyncore.py b/Lib/asyncore.py index c23c8aa..c3b9d76 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: |
