Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
fix: make sure that callbacks are called only once
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Jan 10, 2017
1 parent 8032ab8 commit 12a43d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"interface-connection": "^0.3.0",
"lodash.isfunction": "^3.0.8",
"lodash.range": "^3.2.0",
"once": "^1.4.0",
"pull-handshake": "^1.1.4",
"pull-length-prefixed": "^1.2.0",
"pull-stream": "^3.5.0",
Expand Down
2 changes: 2 additions & 0 deletions src/dialer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const pullLP = require('pull-length-prefixed')
const Connection = require('interface-connection').Connection
const util = require('../util')
const select = require('../select')
const once = require('once')

const PROTOCOL_ID = require('./../constants').PROTOCOL_ID

Expand All @@ -31,6 +32,7 @@ class Dialer {
*/
handle (rawConn, callback) {
this.log('dialer handle conn')
callback = once(callback)
const s = select(PROTOCOL_ID, (err, conn) => {
if (err) {
return callback(err)
Expand Down

0 comments on commit 12a43d3

Please sign in to comment.