|
|
@ -133,6 +133,7 @@ class IO { |
|
|
|
_finish (rid, err, val, peer) { |
|
|
|
const req = this._requests[rid] |
|
|
|
if (!req) return |
|
|
|
if (req.holepunch) clearTimeout(req.holepunch) |
|
|
|
|
|
|
|
this._requests[rid] = undefined |
|
|
|
const top = this.inflight[this.inflight.length - 1] |
|
|
@ -180,7 +181,13 @@ class IO { |
|
|
|
buffer, |
|
|
|
peer, |
|
|
|
timeout: this._ticking ? 5 : 4, // if ticking this will be decremented after this fun call
|
|
|
|
tries: 0 |
|
|
|
tries: 0, |
|
|
|
holepunch: null |
|
|
|
} |
|
|
|
|
|
|
|
if (req.peer.referrer && !req.peer.fastHolepunch) { |
|
|
|
req.peer.fastHolepunch = true |
|
|
|
req.holepunch = setTimeout(holepunchNT, 500, this, req) |
|
|
|
} |
|
|
|
|
|
|
|
this._requests[rid] = req |
|
|
@ -324,6 +331,10 @@ module.exports = IO |
|
|
|
|
|
|
|
function noop () {} |
|
|
|
|
|
|
|
function holepunchNT (io, req) { |
|
|
|
io._holepunch(req) |
|
|
|
} |
|
|
|
|
|
|
|
function decodeMessage (buf) { |
|
|
|
try { |
|
|
|
return Message.decode(buf) |
|
|
|