Commit e16e54f7 authored by Jeremy Hylton's avatar Jeremy Hylton

Use connect_ex() instead of connect().

Removes old XXX comment and possible source of long-delays.
parent fbd5797e
......@@ -53,7 +53,7 @@ import sys
import os
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
ENOTCONN, ESHUTDOWN, EINTR
ENOTCONN, ESHUTDOWN, EINTR, EISCONN
try:
socket_map
......@@ -301,17 +301,14 @@ class dispatcher:
def connect (self, address):
self.connected = 0
# XXX why not use connect_ex?
try:
self.socket.connect (address)
except socket.error, why:
if why[0] in (EINPROGRESS, EALREADY, EWOULDBLOCK):
return
else:
raise socket.error, why
self.addr = address
self.connected = 1
self.handle_connect()
err = self.socket.connect_ex(address)
if err in (EINPROGRESS, EALREADY, EWOULDBLOCK):
return
if err in (0, EISCONN):
self.addr = address
self.connected = 1
self.handle_connect()
raise socket.error, err
def accept (self):
try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment