cleanups (#319)
This commit is contained in:
parent
c6c0c152c0
commit
7c2ab38da1
|
@ -79,7 +79,7 @@ method init*(s: Secure) {.gcsafe.} =
|
|||
except CancelledError as exc:
|
||||
warn "securing connection canceled"
|
||||
await conn.close()
|
||||
raise
|
||||
raise exc
|
||||
except CatchableError as exc:
|
||||
warn "securing connection failed", msg = exc.msg
|
||||
await conn.close()
|
||||
|
|
|
@ -306,6 +306,6 @@ method close*(s: BufferStream) {.async, gcsafe.} =
|
|||
else:
|
||||
trace "attempt to close an already closed bufferstream", trace = getStackTrace()
|
||||
except CancelledError as exc:
|
||||
raise
|
||||
raise exc
|
||||
except CatchableError as exc:
|
||||
trace "error closing buffer stream", exc = exc.msg
|
||||
|
|
|
@ -68,7 +68,7 @@ type
|
|||
streamHandler*: StreamHandler
|
||||
secureManagers*: seq[Secure]
|
||||
pubSub*: Option[PubSub]
|
||||
dialLock: Table[string, AsyncLock]
|
||||
dialLock: Table[PeerID, AsyncLock]
|
||||
hooks: Table[Lifecycle, HashSet[Hook]]
|
||||
pubsubMonitors: Table[PeerId, Future[void]]
|
||||
|
||||
|
@ -291,7 +291,7 @@ proc internalConnect(s: Switch,
|
|||
|
||||
return conn
|
||||
|
||||
let lock = s.dialLock.mgetOrPut($peerId, newAsyncLock())
|
||||
let lock = s.dialLock.mgetOrPut(peerId, newAsyncLock())
|
||||
|
||||
try:
|
||||
await lock.acquire()
|
||||
|
@ -315,7 +315,7 @@ proc internalConnect(s: Switch,
|
|||
libp2p_dialed_peers.inc()
|
||||
except CancelledError as exc:
|
||||
trace "dialing canceled", exc = exc.msg, peer = peerId
|
||||
raise
|
||||
raise exc
|
||||
except CatchableError as exc:
|
||||
trace "dialing failed", exc = exc.msg, peer = peerId
|
||||
libp2p_failed_dials.inc()
|
||||
|
|
Loading…
Reference in New Issue