@@ -8,7 +8,6 @@ import { Event, Emitter } from 'vs/base/common/event';
88import { IMessagePassingProtocol , ClientConnectionEvent , IPCServer , IPCClient } from 'vs/base/parts/ipc/node/ipc' ;
99import { join } from 'vs/base/common/path' ;
1010import { tmpdir } from 'os' ;
11- import * as fs from 'fs' ;
1211import { generateUuid } from 'vs/base/common/uuid' ;
1312import { IDisposable } from 'vs/base/common/lifecycle' ;
1413import { VSBuffer } from 'vs/base/common/buffer' ;
@@ -42,16 +41,6 @@ export function generateRandomPipeName(): string {
4241 }
4342}
4443
45- function log ( fd : number , msg : string , data ?: VSBuffer ) : void {
46- const date = new Date ( ) ;
47- fs . writeSync ( fd , `[${ date . getHours ( ) } :${ date . getMinutes ( ) } :${ date . getSeconds ( ) } .${ date . getMilliseconds ( ) } ] ${ msg } \n` ) ;
48- if ( data ) {
49- fs . writeSync ( fd , data ) ;
50- fs . writeSync ( fd , `\n---------------------------------------------------------------------------------------------------------\n` ) ;
51- }
52- fs . fdatasyncSync ( fd ) ;
53- }
54-
5544let emptyBuffer : VSBuffer | null = null ;
5645function getEmptyBuffer ( ) : VSBuffer {
5746 if ( ! emptyBuffer ) {
@@ -138,16 +127,6 @@ const enum ProtocolMessageType {
138127 KeepAlive = 4
139128}
140129
141- function ProtocolMessageTypeToString ( type : ProtocolMessageType ) : string {
142- switch ( type ) {
143- case ProtocolMessageType . None : return 'None' ;
144- case ProtocolMessageType . Regular : return 'Regular' ;
145- case ProtocolMessageType . Control : return 'Control' ;
146- case ProtocolMessageType . Ack : return 'Ack' ;
147- case ProtocolMessageType . KeepAlive : return 'KeepAlive' ;
148- }
149- }
150-
151130export const enum ProtocolConstants {
152131 HeaderLength = 13 ,
153132 /**
@@ -277,15 +256,13 @@ class ProtocolWriter {
277256
278257 private _isDisposed : boolean ;
279258 private readonly _socket : Socket ;
280- private readonly _logFile : number ;
281259 private _data : VSBuffer [ ] ;
282260 private _totalLength : number ;
283261 public lastWriteTime : number ;
284262
285- constructor ( socket : Socket , logFile : number ) {
263+ constructor ( socket : Socket ) {
286264 this . _isDisposed = false ;
287265 this . _socket = socket ;
288- this . _logFile = logFile ;
289266 this . _data = [ ] ;
290267 this . _totalLength = 0 ;
291268 this . lastWriteTime = 0 ;
@@ -307,9 +284,6 @@ class ProtocolWriter {
307284 console . warn ( msg ) ;
308285 return ;
309286 }
310- if ( this . _logFile ) {
311- log ( this . _logFile , `send-${ ProtocolMessageTypeToString ( msg . type ) } -${ msg . id } -${ msg . ack } -` , msg . data ) ;
312- }
313287 msg . writtenTime = Date . now ( ) ;
314288 this . lastWriteTime = Date . now ( ) ;
315289 const header = VSBuffer . alloc ( ProtocolConstants . HeaderLength ) ;
@@ -392,7 +366,7 @@ export class Protocol implements IDisposable, IMessagePassingProtocol {
392366
393367 constructor ( socket : Socket ) {
394368 this . _socket = socket ;
395- this . _socketWriter = new ProtocolWriter ( this . _socket , 0 ) ;
369+ this . _socketWriter = new ProtocolWriter ( this . _socket ) ;
396370 this . _socketReader = new ProtocolReader ( this . _socket ) ;
397371
398372 this . _socketReader . onMessage ( ( msg ) => {
@@ -605,7 +579,6 @@ class Queue<T> {
605579 */
606580export class PersistentProtocol {
607581
608- private _logFile : number ;
609582 private _isReconnecting : boolean ;
610583
611584 private _outgoingUnackMsg : Queue < ProtocolMessage > ;
@@ -649,13 +622,8 @@ export class PersistentProtocol {
649622 return this . _outgoingMsgId - this . _outgoingAckId ;
650623 }
651624
652- constructor ( socket : Socket , initialChunk : VSBuffer | null = null , logFileName : string | null = null ) {
653- this . _logFile = 0 ;
625+ constructor ( socket : Socket , initialChunk : VSBuffer | null = null ) {
654626 this . _isReconnecting = false ;
655- if ( logFileName ) {
656- console . log ( `PersistentProtocol log file: ${ logFileName } ` ) ;
657- this . _logFile = fs . openSync ( logFileName , 'a' ) ;
658- }
659627 this . _outgoingUnackMsg = new Queue < ProtocolMessage > ( ) ;
660628 this . _outgoingMsgId = 0 ;
661629 this . _outgoingAckId = 0 ;
@@ -682,7 +650,7 @@ export class PersistentProtocol {
682650 } ;
683651
684652 this . _socket = socket ;
685- this . _socketWriter = new ProtocolWriter ( this . _socket , this . _logFile ) ;
653+ this . _socketWriter = new ProtocolWriter ( this . _socket ) ;
686654 this . _socketReader = new ProtocolReader ( this . _socket ) ;
687655 this . _socketReaderListener = this . _socketReader . onMessage ( msg => this . _receiveMessage ( msg ) ) ;
688656 this . _socket . on ( 'close' , this . _socketCloseListener ) ;
@@ -713,9 +681,6 @@ export class PersistentProtocol {
713681 clearTimeout ( this . _incomingKeepAliveTimeout ) ;
714682 this . _incomingKeepAliveTimeout = null ;
715683 }
716- if ( this . _logFile ) {
717- fs . closeSync ( this . _logFile ) ;
718- }
719684 this . _socketWriter . dispose ( ) ;
720685 this . _socketReader . dispose ( ) ;
721686 this . _socketReaderListener . dispose ( ) ;
@@ -782,7 +747,7 @@ export class PersistentProtocol {
782747
783748 this . _socket = socket ;
784749
785- this . _socketWriter = new ProtocolWriter ( this . _socket , this . _logFile ) ;
750+ this . _socketWriter = new ProtocolWriter ( this . _socket ) ;
786751 this . _socketReader = new ProtocolReader ( this . _socket ) ;
787752 this . _socketReaderListener = this . _socketReader . onMessage ( msg => this . _receiveMessage ( msg ) ) ;
788753 this . _socketReader . acceptChunk ( initialDataChunk ) ;
@@ -806,9 +771,6 @@ export class PersistentProtocol {
806771 }
807772
808773 private _receiveMessage ( msg : ProtocolMessage ) : void {
809- if ( this . _logFile ) {
810- log ( this . _logFile , `recv-${ ProtocolMessageTypeToString ( msg . type ) } -${ msg . id } -${ msg . ack } -` , msg . data ) ;
811- }
812774 if ( msg . ack > this . _outgoingAckId ) {
813775 this . _outgoingAckId = msg . ack ;
814776 do {
0 commit comments