mirror of https://github.com/vacp2p/nim-libp2p.git
Workaround for https://github.com/nim-lang/Nim/issues/12764 .
Remove usage of getCurrentException().
This commit is contained in:
parent
253aa7cf75
commit
dde8c01448
|
@ -894,9 +894,8 @@ proc openStream*(api: DaemonAPI, peer: PeerID,
|
||||||
stream.flags.incl(Outbound)
|
stream.flags.incl(Outbound)
|
||||||
stream.transp = transp
|
stream.transp = transp
|
||||||
result = stream
|
result = stream
|
||||||
except:
|
finally:
|
||||||
await api.closeConnection(transp)
|
await api.closeConnection(transp)
|
||||||
raise getCurrentException()
|
|
||||||
|
|
||||||
proc streamHandler(server: StreamServer, transp: StreamTransport) {.async.} =
|
proc streamHandler(server: StreamServer, transp: StreamTransport) {.async.} =
|
||||||
var api = getUserData[DaemonAPI](server)
|
var api = getUserData[DaemonAPI](server)
|
||||||
|
@ -933,14 +932,12 @@ proc addHandler*(api: DaemonAPI, protocols: seq[string],
|
||||||
protocols))
|
protocols))
|
||||||
pb.withMessage() do:
|
pb.withMessage() do:
|
||||||
api.servers.add(P2PServer(server: server, address: maddress))
|
api.servers.add(P2PServer(server: server, address: maddress))
|
||||||
except:
|
finally:
|
||||||
for item in protocols:
|
for item in protocols:
|
||||||
api.handlers.del(item)
|
api.handlers.del(item)
|
||||||
server.stop()
|
server.stop()
|
||||||
server.close()
|
server.close()
|
||||||
await server.join()
|
await server.join()
|
||||||
raise getCurrentException()
|
|
||||||
finally:
|
|
||||||
await api.closeConnection(transp)
|
await api.closeConnection(transp)
|
||||||
|
|
||||||
proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async.} =
|
proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async.} =
|
||||||
|
@ -1301,9 +1298,8 @@ proc pubsubSubscribe*(api: DaemonAPI, topic: string,
|
||||||
ticket.transp = transp
|
ticket.transp = transp
|
||||||
asyncCheck pubsubLoop(api, ticket)
|
asyncCheck pubsubLoop(api, ticket)
|
||||||
result = ticket
|
result = ticket
|
||||||
except:
|
finally:
|
||||||
await api.closeConnection(transp)
|
await api.closeConnection(transp)
|
||||||
raise getCurrentException()
|
|
||||||
|
|
||||||
proc `$`*(pinfo: PeerInfo): string =
|
proc `$`*(pinfo: PeerInfo): string =
|
||||||
## Get string representation of ``PeerInfo`` object.
|
## Get string representation of ``PeerInfo`` object.
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
## Nim-LibP2P
|
## Nim-LibP2P
|
||||||
## Copyright (c) 2019 Status Research & Development GmbH
|
## Copyright (c) 2019 Status Research & Development GmbH
|
||||||
## Licensed under either of
|
## Licensed under either of
|
||||||
|
@ -405,8 +404,8 @@ proc readLoop(sconn: SecureConnection, stream: BufferStream) {.async.} =
|
||||||
try:
|
try:
|
||||||
let msg = await sconn.readMessage()
|
let msg = await sconn.readMessage()
|
||||||
await stream.pushTo(msg)
|
await stream.pushTo(msg)
|
||||||
except:
|
except CatchableError as exc:
|
||||||
trace "exception in secio", exc = getCurrentExceptionMsg()
|
trace "exception in secio", exc = exc
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
trace "ending secio readLoop"
|
trace "ending secio readLoop"
|
||||||
|
|
Loading…
Reference in New Issue