File tree 1 file changed +4
-1
lines changed
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ function use (extensions) {
64
64
65
65
this . _nonce = randomBytes ( 24 )
66
66
this . _remoteNonce = null
67
+ this . _ready = false
67
68
68
69
this . _firstNonce = Buffer ( 24 )
69
70
this . _nonce . copy ( this . _firstNonce )
@@ -293,6 +294,8 @@ function use (extensions) {
293
294
this . _open ( ch )
294
295
if ( ch . buffer . length ) this . _parseSoon ( ch )
295
296
297
+ ch . _ready = true // to avoid premature events
298
+
296
299
return ch
297
300
}
298
301
@@ -418,7 +421,7 @@ function use (extensions) {
418
421
Protocol . prototype . _onmessage = function ( remote , data , offset ) {
419
422
var channel = this . _remote [ remote ]
420
423
421
- if ( ! channel . key || channel . buffer . length ) {
424
+ if ( ! channel . key || channel . buffer . length || ! channel . _ready ) {
422
425
if ( channel . buffer . length === 16 ) return this . destroy ( new Error ( 'Buffer overflow' ) )
423
426
channel . buffer . push ( data )
424
427
return
You can’t perform that action at this time.
0 commit comments