mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-15 01:40:51 +00:00
fix: avoid sync callback in async function
This commit is contained in:
parent
35230c9800
commit
dcb75824aa
@ -28,10 +28,10 @@
|
||||
"async": "^2.6.1",
|
||||
"debug": "^4.1.0",
|
||||
"interface-connection": "~0.3.2",
|
||||
"libp2p-crypto": "~0.14.0",
|
||||
"libp2p-crypto": "github:libp2p/js-libp2p-crypto#fix/async",
|
||||
"multihashing-async": "~0.5.1",
|
||||
"peer-id": "~0.12.0",
|
||||
"peer-info": "~0.14.1",
|
||||
"peer-info": "~0.15.0",
|
||||
"protons": "^1.0.1",
|
||||
"pull-defer": "~0.2.3",
|
||||
"pull-handshake": "^1.1.4",
|
||||
@ -39,11 +39,10 @@
|
||||
"pull-stream": "^3.6.9"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aegir": "^17.0.1",
|
||||
"aegir": "^17.1.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"chai": "^4.2.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"gulp": "^3.9.1",
|
||||
"libp2p-websockets": "~0.12.0",
|
||||
"multistream-select": "~0.14.3",
|
||||
"pull-goodbye": "~0.0.2",
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
const pull = require('pull-stream')
|
||||
const lp = require('pull-length-prefixed')
|
||||
const setImmediate = require('async/setImmediate')
|
||||
|
||||
const lpOpts = {
|
||||
fixed: true,
|
||||
@ -39,7 +40,7 @@ exports.createUnboxStream = (decipher, mac) => {
|
||||
const macSize = mac.length
|
||||
|
||||
if (l < macSize) {
|
||||
return cb(new Error(`buffer (${l}) shorter than MAC size (${macSize})`))
|
||||
return setImmediate(() => cb(new Error(`buffer (${l}) shorter than MAC size (${macSize})`)))
|
||||
}
|
||||
|
||||
const mark = l - macSize
|
||||
|
Loading…
x
Reference in New Issue
Block a user