Skip to content

Commit

Permalink
cleanups (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck authored Aug 6, 2020
1 parent c6c0c15 commit 7c2ab38
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libp2p/protocols/secure/secure.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion libp2p/stream/bufferstream.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions libp2p/switch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 7c2ab38

Please sign in to comment.