Skip to content

Commit

Permalink
fix(libp2p): Updating nim-libp2p to fix the wss connectivity issue (#…
Browse files Browse the repository at this point in the history
…1848)

* Updating nim-libp2p to fix the `wss` connectivity issue

* The `nim-libp2p` adds many changes although we are actually interested
in the latest commit:

> wstransport.nim: avoid re-raising 'TransportOsError' to avoid stopping
`switch.accept` (#929)

* The `nim-stew` bump is needed so that the `nim-libp2p` can compile.

* The changes in `waku_node.nim` are needed due to the changes in
`nim-stew`.

* waku_node.nim: returning a "completed" future within 'statusAndConfidenceHandler'

  This is aimed to avoid the next exception happening in the wakunode:

  ```
  Unhandled defect: Async procedure (service.nim(74)    callHandler)
  yielded `nil`, are you await'ing a `nil` Future? [AssertionDefect]
  ```

  * Adding 'async' to 'statusAndConfidenceHandler' so that it properly returns a Future[void]
  • Loading branch information
Ivansete-status authored Jul 13, 2023
1 parent 3fe4522 commit 1d3410c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vendor/nim-libp2p
6 changes: 4 additions & 2 deletions waku/v2/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,15 @@ proc getAutonatService*(rng: ref HmacDrbgContext): AutonatService =
let autonatService = AutonatService.new(
autonatClient = AutonatClient.new(),
rng = rng,
scheduleInterval = some(chronos.seconds(120)),
scheduleInterval = Opt.some(chronos.seconds(120)),
askNewConnectedPeers = false,
numPeersToAsk = 3,
maxQueueSize = 3,
minConfidence = 0.7)

proc statusAndConfidenceHandler(networkReachability: NetworkReachability, confidence: Option[float]) {.gcsafe, async.} =
proc statusAndConfidenceHandler(networkReachability: NetworkReachability,
confidence: Opt[float]):
Future[void] {.gcsafe, async.} =
if confidence.isSome():
info "Peer reachability status", networkReachability=networkReachability, confidence=confidence.get()

Expand Down

0 comments on commit 1d3410c

Please sign in to comment.