retry indefinitly is back. fixes #2411. please test that
This commit is contained in:
parent
bf6f5dd139
commit
e9755daa9d
|
@ -367,8 +367,7 @@ class Connection(ConnectionHandlers):
|
|||
secure = self._secure)
|
||||
return
|
||||
else:
|
||||
if not retry:
|
||||
self.retrycount = 0
|
||||
if not retry and self.retrycount == 0:
|
||||
self.time_to_reconnect = None
|
||||
if self.on_connect_failure:
|
||||
self.on_connect_failure()
|
||||
|
|
|
@ -125,6 +125,8 @@ class NBCommonClient(CommonClient):
|
|||
self.on_connect_failure(retry)
|
||||
|
||||
def _on_connected(self):
|
||||
# connect succeded, so no need of this callback anymore
|
||||
self.on_connect_failure = None
|
||||
self.connected = 'tcp'
|
||||
if self._Ssl:
|
||||
transports_nb.NonBlockingTLS().PlugIn(self, now=1)
|
||||
|
|
|
@ -143,11 +143,11 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
def pollin(self):
|
||||
self._do_receive()
|
||||
|
||||
def pollend(self):
|
||||
def pollend(self, retry = False):
|
||||
conn_failure_cb = self.on_connect_failure
|
||||
self.disconnect()
|
||||
if conn_failure_cb:
|
||||
conn_failure_cb()
|
||||
conn_failure_cb(retry)
|
||||
|
||||
def disconnect(self):
|
||||
if self.state == -2: # already disconnected
|
||||
|
@ -216,15 +216,19 @@ class NonBlockingTcp(PlugIn, IdleObject):
|
|||
# "received" will be empty anyhow
|
||||
if errnum == socket.SSL_ERROR_WANT_READ:
|
||||
pass
|
||||
elif errnum in [errno.ECONNRESET, errno.ENOTCONN, errno.ESHUTDOWN]:
|
||||
elif errnum == errno.ECONNRESET:
|
||||
self.pollend(True)
|
||||
# don't proccess result, caus it will raise error
|
||||
return
|
||||
elif errnum in [errno.ENOTCONN, errno.ESHUTDOWN]:
|
||||
self.pollend()
|
||||
# don't proccess result, cas it will raise error
|
||||
# don't proccess result, caus it will raise error
|
||||
return
|
||||
elif not received :
|
||||
if errnum != socket.SSL_ERROR_EOF:
|
||||
# 8 EOF occurred in violation of protocol
|
||||
self.DEBUG('Socket error while receiving data', 'error')
|
||||
self.pollend()
|
||||
self.pollend(True)
|
||||
if self.state >= 0:
|
||||
self.disconnect()
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue