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.transp = transp
|
||||
result = stream
|
||||
except:
|
||||
finally:
|
||||
await api.closeConnection(transp)
|
||||
raise getCurrentException()
|
||||
|
||||
proc streamHandler(server: StreamServer, transp: StreamTransport) {.async.} =
|
||||
var api = getUserData[DaemonAPI](server)
|
||||
|
@ -933,14 +932,12 @@ proc addHandler*(api: DaemonAPI, protocols: seq[string],
|
|||
protocols))
|
||||
pb.withMessage() do:
|
||||
api.servers.add(P2PServer(server: server, address: maddress))
|
||||
except:
|
||||
finally:
|
||||
for item in protocols:
|
||||
api.handlers.del(item)
|
||||
server.stop()
|
||||
server.close()
|
||||
await server.join()
|
||||
raise getCurrentException()
|
||||
finally:
|
||||
await api.closeConnection(transp)
|
||||
|
||||
proc listPeers*(api: DaemonAPI): Future[seq[PeerInfo]] {.async.} =
|
||||
|
@ -1301,9 +1298,8 @@ proc pubsubSubscribe*(api: DaemonAPI, topic: string,
|
|||
ticket.transp = transp
|
||||
asyncCheck pubsubLoop(api, ticket)
|
||||
result = ticket
|
||||
except:
|
||||
finally:
|
||||
await api.closeConnection(transp)
|
||||
raise getCurrentException()
|
||||
|
||||
proc `$`*(pinfo: PeerInfo): string =
|
||||
## Get string representation of ``PeerInfo`` object.
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
## Nim-LibP2P
|
||||
## Copyright (c) 2019 Status Research & Development GmbH
|
||||
## Licensed under either of
|
||||
|
@ -405,8 +404,8 @@ proc readLoop(sconn: SecureConnection, stream: BufferStream) {.async.} =
|
|||
try:
|
||||
let msg = await sconn.readMessage()
|
||||
await stream.pushTo(msg)
|
||||
except:
|
||||
trace "exception in secio", exc = getCurrentExceptionMsg()
|
||||
except CatchableError as exc:
|
||||
trace "exception in secio", exc = exc
|
||||
return
|
||||
finally:
|
||||
trace "ending secio readLoop"
|
||||
|
|
Loading…
Reference in New Issue