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