mirror of
https://github.com/fluencelabs/js-libp2p-secio
synced 2025-03-15 18:00:52 +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",
|
"async": "^2.6.1",
|
||||||
"debug": "^4.1.0",
|
"debug": "^4.1.0",
|
||||||
"interface-connection": "~0.3.2",
|
"interface-connection": "~0.3.2",
|
||||||
"libp2p-crypto": "~0.14.0",
|
"libp2p-crypto": "github:libp2p/js-libp2p-crypto#fix/async",
|
||||||
"multihashing-async": "~0.5.1",
|
"multihashing-async": "~0.5.1",
|
||||||
"peer-id": "~0.12.0",
|
"peer-id": "~0.12.0",
|
||||||
"peer-info": "~0.14.1",
|
"peer-info": "~0.15.0",
|
||||||
"protons": "^1.0.1",
|
"protons": "^1.0.1",
|
||||||
"pull-defer": "~0.2.3",
|
"pull-defer": "~0.2.3",
|
||||||
"pull-handshake": "^1.1.4",
|
"pull-handshake": "^1.1.4",
|
||||||
@ -39,11 +39,10 @@
|
|||||||
"pull-stream": "^3.6.9"
|
"pull-stream": "^3.6.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aegir": "^17.0.1",
|
"aegir": "^17.1.1",
|
||||||
"benchmark": "^2.1.4",
|
"benchmark": "^2.1.4",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"gulp": "^3.9.1",
|
|
||||||
"libp2p-websockets": "~0.12.0",
|
"libp2p-websockets": "~0.12.0",
|
||||||
"multistream-select": "~0.14.3",
|
"multistream-select": "~0.14.3",
|
||||||
"pull-goodbye": "~0.0.2",
|
"pull-goodbye": "~0.0.2",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const pull = require('pull-stream')
|
const pull = require('pull-stream')
|
||||||
const lp = require('pull-length-prefixed')
|
const lp = require('pull-length-prefixed')
|
||||||
|
const setImmediate = require('async/setImmediate')
|
||||||
|
|
||||||
const lpOpts = {
|
const lpOpts = {
|
||||||
fixed: true,
|
fixed: true,
|
||||||
@ -39,7 +40,7 @@ exports.createUnboxStream = (decipher, mac) => {
|
|||||||
const macSize = mac.length
|
const macSize = mac.length
|
||||||
|
|
||||||
if (l < macSize) {
|
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
|
const mark = l - macSize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user