From 6ddc1da7cac98978f4d251c2c8732cb75e6337c1 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 23 Nov 2021 11:43:10 +0100 Subject: #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. --- src/ogClient.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3-18-g5258