Skip to content

Commit

Permalink
Merge pull request #904 from tuxcanfly/pool-handle-errs
Browse files Browse the repository at this point in the history
pool: catch peer handler errs
  • Loading branch information
braydonf committed Nov 5, 2019
2 parents 77d8804 + 843e79c commit 7bc3251
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/net/pool.js
Expand Up @@ -1126,8 +1126,12 @@ class Pool extends EventEmitter {
this.handleConnect(peer);
});

peer.once('open', () => {
this.handleOpen(peer);
peer.once('open', async () => {
try {
await this.handleOpen(peer);
} catch (e) {
this.emit('error', e);
}
});

peer.once('close', (connected) => {
Expand Down

0 comments on commit 7bc3251

Please sign in to comment.