Skip to content

Commit cd11e28

Browse files
committed
Remove 'inconnect' Connection flag
There are cases when this flag is not set appropriately, that lead to a reconnection stuck: at least the case that was fixed in the commit 'Fix stuck autoreconnect case'. To more on that, this flag was only needed to workaround Windows-related bug with broken socket liveness check. Now it is fixed, so it is safe to remove it. Fixes #108.
1 parent 145531d commit cd11e28

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

tarantool/connection.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def __init__(self, host, port,
122122
self.schema_version = 1
123123
self._socket = None
124124
self.connected = False
125-
self.inconnect = False
126125
self.error = True
127126
self.encoding = encoding
128127
self.call_16 = call_16
@@ -201,14 +200,11 @@ def connect(self):
201200
:raise: `NetworkError`
202201
'''
203202
try:
204-
self.inconnect = True
205203
self.connect_basic()
206204
self.handshake()
207205
self.load_schema()
208-
self.inconnect = False
209206
except Exception as e:
210207
self.connected = False
211-
self.inconnect = False
212208
raise NetworkError(e)
213209

214210
def _recv(self, to_read):
@@ -277,8 +273,6 @@ def _opt_reconnect(self):
277273
Check that connection is alive using low-level recv from libc(ctypes)
278274
**Due to bug in python - timeout is internal python construction.
279275
'''
280-
if self.inconnect:
281-
return
282276
if not self._socket:
283277
return self.connect()
284278

@@ -335,13 +329,7 @@ def check(): # Check that connection is alive
335329
raise NetworkError(
336330
socket.error(last_errno, errno.errorcode[last_errno]))
337331
attempt += 1
338-
try:
339-
self.inconnect = True
340-
self.handshake()
341-
self.inconnect = False
342-
except:
343-
self.inconnect = False
344-
raise
332+
self.handshake()
345333

346334
def _send_request(self, request):
347335
'''

0 commit comments

Comments
 (0)