summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2021-11-23 11:43:10 +0100
committerJose M. Guisado <jguisado@soleta.eu>2021-11-23 12:46:31 +0100
commit6ddc1da7cac98978f4d251c2c8732cb75e6337c1 (patch)
tree065c6b81dd59e307896c240d5a71979e9faa72a4 /src
parentb5d5d29d31b6bc4402a9182aaee7b91365969863 (diff)
#1065 Fix windows not reattempting refused connections
Windows does not report a refused connection the same way as Linux. Unsuccesful connect socket will be kept in the exceptfds, and won't be in the readable nor writable fds. The socket in this state will have SO_ERROR set to ECONNREFUSED. On the other hand, Linux does not use exceptfds for such case.
Diffstat (limited to 'src')
-rw-r--r--src/ogClient.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ogClient.py b/src/ogClient.py
index 5fcb1c8..5fff77c 100644
--- a/src/ogClient.py
+++ b/src/ogClient.py
@@ -143,16 +143,20 @@ class ogClient:
if state == State.CONNECTING:
readset = [ sock ]
writeset = [ sock ]
+ exceptset = [ sock ]
elif state == State.FORCE_DISCONNECTED:
return 0
else:
readset = [ sock ]
writeset = [ ]
+ exceptset = [ ]
- readable, writable, exception = select.select(readset, writeset, [ ])
+ readable, writable, exception = select.select(readset, writeset, exceptset)
if state == State.CONNECTING and sock in writable:
self.connect2()
elif state == State.RECEIVING and sock in readable:
self.receive()
+ elif state == State.CONNECTING and sock in exception:
+ self.connect2()
else:
print('wrong state, not ever happen!' + str(state))