mirror of https://github.com/status-im/nim-eth.git
Avoid double socket destroy on timed-out uTP SYN-ACK (#619)
This commit is contained in:
parent
d766fc435e
commit
cea23299be
|
@ -576,9 +576,13 @@ proc checkTimeouts(socket: UtpSocket) =
|
||||||
retransmitCount = socket.retransmitCount
|
retransmitCount = socket.retransmitCount
|
||||||
|
|
||||||
if socket.state == SynSent and (not socket.connectionFuture.finished()):
|
if socket.state == SynSent and (not socket.connectionFuture.finished()):
|
||||||
socket.connectionFuture.fail(newException(ConnectionError, "Connection to peer timed out"))
|
# Note: The socket connect code will already call socket.destroy when
|
||||||
|
# ConnectionError gets raised, no need to do it here.
|
||||||
|
socket.connectionFuture.fail(newException(
|
||||||
|
ConnectionError, "Connection to peer timed out"))
|
||||||
|
else:
|
||||||
socket.destroy()
|
socket.destroy()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
let newTimeout = socket.retransmitTimeout * 2
|
let newTimeout = socket.retransmitTimeout * 2
|
||||||
|
|
Loading…
Reference in New Issue