File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -251,8 +251,10 @@ export class Socket extends EventEmitter {
251
251
if ( this . sentCallbackFn . length > 0 ) {
252
252
debug ( "executing batch send callback" ) ;
253
253
const seqFn = this . sentCallbackFn . shift ( ) ;
254
- for ( let i = 0 ; i < seqFn . length ; i ++ ) {
255
- seqFn [ i ] ( this . transport ) ;
254
+ if ( seqFn ) {
255
+ for ( let i = 0 ; i < seqFn . length ; i ++ ) {
256
+ seqFn [ i ] ( this . transport ) ;
257
+ }
256
258
}
257
259
}
258
260
}
@@ -491,8 +493,14 @@ export class Socket extends EventEmitter {
491
493
this . server . emit ( "flush" , this , this . writeBuffer ) ;
492
494
const wbuf = this . writeBuffer ;
493
495
this . writeBuffer = [ ] ;
494
- this . sentCallbackFn . push ( this . packetsFn ) ;
495
- this . packetsFn = [ ] ;
496
+
497
+ if ( this . packetsFn . length ) {
498
+ this . sentCallbackFn . push ( this . packetsFn ) ;
499
+ this . packetsFn = [ ] ;
500
+ } else {
501
+ this . sentCallbackFn . push ( null ) ;
502
+ }
503
+
496
504
this . transport . send ( wbuf ) ;
497
505
this . emit ( "drain" ) ;
498
506
this . server . emit ( "drain" , this ) ;
You can’t perform that action at this time.
0 commit comments