mirror of https://github.com/vacp2p/nim-libp2p.git
Fix minor exception issues (#550)
Makes code compatible with https://github.com/status-im/nim-chronos/pull/166 without requiring it.
This commit is contained in:
parent
38333e45ae
commit
54031c9e9b
|
@ -41,7 +41,7 @@ proc isUpgraded*(s: Connection): bool =
|
||||||
if not isNil(s.upgraded):
|
if not isNil(s.upgraded):
|
||||||
return s.upgraded.finished
|
return s.upgraded.finished
|
||||||
|
|
||||||
proc upgrade*(s: Connection, failed: ref Exception = nil) =
|
proc upgrade*(s: Connection, failed: ref CatchableError = nil) =
|
||||||
if not isNil(s.upgraded):
|
if not isNil(s.upgraded):
|
||||||
if not isNil(failed):
|
if not isNil(failed):
|
||||||
s.upgraded.fail(failed)
|
s.upgraded.fail(failed)
|
||||||
|
|
|
@ -85,8 +85,6 @@ proc removePeerEventHandler*(s: Switch,
|
||||||
kind: PeerEventKind) =
|
kind: PeerEventKind) =
|
||||||
s.connManager.removePeerEventHandler(handler, kind)
|
s.connManager.removePeerEventHandler(handler, kind)
|
||||||
|
|
||||||
proc disconnect*(s: Switch, peerId: PeerID) {.async, gcsafe.}
|
|
||||||
|
|
||||||
proc isConnected*(s: Switch, peerId: PeerID): bool =
|
proc isConnected*(s: Switch, peerId: PeerID): bool =
|
||||||
## returns true if the peer has one or more
|
## returns true if the peer has one or more
|
||||||
## associated connections (sockets)
|
## associated connections (sockets)
|
||||||
|
|
|
@ -35,7 +35,7 @@ type
|
||||||
opened*: uint64
|
opened*: uint64
|
||||||
closed*: uint64
|
closed*: uint64
|
||||||
|
|
||||||
proc setupTcpTransportTracker(): TcpTransportTracker {.gcsafe.}
|
proc setupTcpTransportTracker(): TcpTransportTracker {.gcsafe, raises: [Defect].}
|
||||||
|
|
||||||
proc getTcpTransportTracker(): TcpTransportTracker {.gcsafe.} =
|
proc getTcpTransportTracker(): TcpTransportTracker {.gcsafe.} =
|
||||||
result = cast[TcpTransportTracker](getTracker(TcpTransportTrackerName))
|
result = cast[TcpTransportTracker](getTracker(TcpTransportTrackerName))
|
||||||
|
|
Loading…
Reference in New Issue