From 54031c9e9bc9882a2e8c2d5937031731ed63ab5e Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Tue, 23 Mar 2021 07:45:25 +0100 Subject: [PATCH] Fix minor exception issues (#550) Makes code compatible with https://github.com/status-im/nim-chronos/pull/166 without requiring it. --- libp2p/stream/connection.nim | 2 +- libp2p/switch.nim | 2 -- libp2p/transports/tcptransport.nim | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/libp2p/stream/connection.nim b/libp2p/stream/connection.nim index ba888c9db..005149c72 100644 --- a/libp2p/stream/connection.nim +++ b/libp2p/stream/connection.nim @@ -41,7 +41,7 @@ proc isUpgraded*(s: Connection): bool = if not isNil(s.upgraded): 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(failed): s.upgraded.fail(failed) diff --git a/libp2p/switch.nim b/libp2p/switch.nim index a947e0708..0274b1dd7 100644 --- a/libp2p/switch.nim +++ b/libp2p/switch.nim @@ -85,8 +85,6 @@ proc removePeerEventHandler*(s: Switch, kind: PeerEventKind) = s.connManager.removePeerEventHandler(handler, kind) -proc disconnect*(s: Switch, peerId: PeerID) {.async, gcsafe.} - proc isConnected*(s: Switch, peerId: PeerID): bool = ## returns true if the peer has one or more ## associated connections (sockets) diff --git a/libp2p/transports/tcptransport.nim b/libp2p/transports/tcptransport.nim index 50513b19c..97c977972 100644 --- a/libp2p/transports/tcptransport.nim +++ b/libp2p/transports/tcptransport.nim @@ -35,7 +35,7 @@ type opened*: uint64 closed*: uint64 -proc setupTcpTransportTracker(): TcpTransportTracker {.gcsafe.} +proc setupTcpTransportTracker(): TcpTransportTracker {.gcsafe, raises: [Defect].} proc getTcpTransportTracker(): TcpTransportTracker {.gcsafe.} = result = cast[TcpTransportTracker](getTracker(TcpTransportTrackerName))