Add catch for exception in any of the disconnect handlers

This commit is contained in:
kdeme 2019-04-02 17:31:40 +02:00 committed by zah
parent 5550179dd1
commit 7fd501136f
1 changed files with 3 additions and 0 deletions

View File

@ -1170,6 +1170,9 @@ proc disconnect*(peer: Peer, reason: DisconnectionReason, notifyOtherPeer = fals
try: try:
if not peer.dispatcher.isNil: if not peer.dispatcher.isNil:
await callDisconnectHandlers(peer, reason) await callDisconnectHandlers(peer, reason)
except:
error "Exception in callDisconnectHandlers()",
err = getCurrentExceptionMsg()
finally: finally:
logDisconnectedPeer peer logDisconnectedPeer peer
peer.connectionState = Disconnected peer.connectionState = Disconnected