mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-06-27 21:32:18 +02:00
windows: improve ssnet/try_connect() logic
This commit is contained in:
parent
b826ae6b91
commit
554b8e3ae5
@ -168,21 +168,25 @@ class SockWrapper:
|
|||||||
debug3('%r: fixed connect result: %s' % (self, e))
|
debug3('%r: fixed connect result: %s' % (self, e))
|
||||||
if e.args[0] in [errno.EINPROGRESS, errno.EALREADY]:
|
if e.args[0] in [errno.EINPROGRESS, errno.EALREADY]:
|
||||||
pass # not connected yet
|
pass # not connected yet
|
||||||
elif sys.platform == 'win32' and e.args[0] == errno.WSAEWOULDBLOCK:
|
elif sys.platform == 'win32' and e.args[0] == errno.WSAEWOULDBLOCK: # 10035
|
||||||
pass # not connected yet
|
pass # not connected yet
|
||||||
elif e.args[0] == 0:
|
elif e.args[0] == 0:
|
||||||
# connected successfully (weird Linux bug?)
|
if sys.platform == 'win32':
|
||||||
# Sometimes Linux seems to return EINVAL when it isn't
|
# On Windows "real" error of EINVAL could be 0, when socket is in connecting state
|
||||||
# invalid. This *may* be caused by a race condition
|
pass
|
||||||
# between connect() and getsockopt(SO_ERROR) (ie. it
|
else:
|
||||||
# finishes connecting in between the two, so there is no
|
# connected successfully (weird Linux bug?)
|
||||||
# longer an error). However, I'm not sure of that.
|
# Sometimes Linux seems to return EINVAL when it isn't
|
||||||
#
|
# invalid. This *may* be caused by a race condition
|
||||||
# I did get at least one report that the problem went away
|
# between connect() and getsockopt(SO_ERROR) (ie. it
|
||||||
# when we added this, however.
|
# finishes connecting in between the two, so there is no
|
||||||
self.connect_to = None
|
# longer an error). However, I'm not sure of that.
|
||||||
|
#
|
||||||
|
# I did get at least one report that the problem went away
|
||||||
|
# when we added this, however.
|
||||||
|
self.connect_to = None
|
||||||
elif e.args[0] == errno.EISCONN:
|
elif e.args[0] == errno.EISCONN:
|
||||||
# connected successfully (BSD)
|
# connected successfully (BSD + Windows)
|
||||||
self.connect_to = None
|
self.connect_to = None
|
||||||
elif e.args[0] in NET_ERRS + [errno.EACCES, errno.EPERM]:
|
elif e.args[0] in NET_ERRS + [errno.EACCES, errno.EPERM]:
|
||||||
# a "normal" kind of error
|
# a "normal" kind of error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user