Skip to content

Commit

Permalink
fix: unhandled promise rejection when async work done after handshake (
Browse files Browse the repository at this point in the history
…#2)

If you do async work after invoking it-handshake but before awaiting
on any of the fields of the response, an unhandledPromiseRejection can
occur if the `stream.sink` method rejects.

This manifests itself in libp2p vis `multiformats/js-multistream-select`
as:

```js
(node:82951) UnhandledPromiseRejectionWarning: Error: already piped
    at Object.sink (node_modules/it-pair/index.js:10:24)
    at module.exports (node_modules/it-handshake/src/index.js:15:30)
    at module.exports (src/select.js:10:57)
    at Dialer.select (src/index.js:27:12)
    at Context.<anonymous> (test/dialer.spec.js:43:26)
```

Also:

- Updates all deps
- Removes node Buffers in favour of Uint8Arrays
  • Loading branch information
achingbrain committed Aug 12, 2020
1 parent 88dd90f commit 61db942
Show file tree
Hide file tree
Showing 4 changed files with 7,616 additions and 6,022 deletions.
Loading

0 comments on commit 61db942

Please sign in to comment.