@@ -34,8 +34,6 @@ export class Manager extends Emitter {
3434 private _timeout : any ;
3535
3636 private connecting : Array < Socket > = [ ] ;
37- private encoding : boolean ;
38- private packetBuffer : Array < any > = [ ] ;
3937 private encoder : Encoder ;
4038 private decoder : Decoder ;
4139 private engine : any ;
@@ -71,7 +69,6 @@ export class Manager extends Emitter {
7169 this . timeout ( null == opts . timeout ? 20000 : opts . timeout ) ;
7270 this . readyState = "closed" ;
7371 this . uri = uri ;
74- this . encoding = false ;
7572 const _parser = opts . parser || parser ;
7673 this . encoder = new _parser . Encoder ( ) ;
7774 this . decoder = new _parser . Decoder ( ) ;
@@ -432,31 +429,9 @@ export class Manager extends Emitter {
432429 debug ( "writing packet %j" , packet ) ;
433430 if ( packet . query && packet . type === 0 ) packet . nsp += "?" + packet . query ;
434431
435- if ( ! this . encoding ) {
436- // encode, then write to engine with result
437- this . encoding = true ;
438- const encodedPackets = this . encoder . encode ( packet ) ;
439- for ( let i = 0 ; i < encodedPackets . length ; i ++ ) {
440- this . engine . write ( encodedPackets [ i ] , packet . options ) ;
441- }
442- this . encoding = false ;
443- this . processPacketQueue ( ) ;
444- } else {
445- // add packet to the queue
446- this . packetBuffer . push ( packet ) ;
447- }
448- }
449-
450- /**
451- * If packet buffer is non-empty, begins encoding the
452- * next packet in line.
453- *
454- * @api private
455- */
456- processPacketQueue ( ) {
457- if ( this . packetBuffer . length > 0 && ! this . encoding ) {
458- const pack = this . packetBuffer . shift ( ) ;
459- this . packet ( pack ) ;
432+ const encodedPackets = this . encoder . encode ( packet ) ;
433+ for ( let i = 0 ; i < encodedPackets . length ; i ++ ) {
434+ this . engine . write ( encodedPackets [ i ] , packet . options ) ;
460435 }
461436 }
462437
@@ -474,9 +449,6 @@ export class Manager extends Emitter {
474449 sub . destroy ( ) ;
475450 }
476451
477- this . packetBuffer = [ ] ;
478- this . encoding = false ;
479-
480452 this . decoder . destroy ( ) ;
481453 }
482454
0 commit comments