@@ -72,7 +72,6 @@ class WebSocketServer {
72
72
private mainProcessSocket : WebSocket | null = null ;
73
73
private gameProcessSocket : WebSocket | null = null ;
74
74
private gameListeners = new Map < GameClientMessageName , GameListener [ ] > ( ) ;
75
- private gameSocketConnectionTimestamp : number | null = null ;
76
75
77
76
constructor ( ) {
78
77
this . server = new WSServer ( {
@@ -153,7 +152,6 @@ class WebSocketServer {
153
152
this . gameProcessSocket . on ( 'close' , this . onGameProcessSocketDisconnect ) ;
154
153
this . gameProcessSocket . on ( 'error' , this . onGameProcessSocketError ) ;
155
154
this . gameProcessSocket . on ( 'message' , this . onGameProcessSocketMessage ) ;
156
- this . gameSocketConnectionTimestamp = Date . now ( ) ;
157
155
}
158
156
} ;
159
157
@@ -315,14 +313,18 @@ class WebSocketServer {
315
313
this . gameProcessSocket = null ;
316
314
317
315
this . gameListeners . clear ( ) ;
318
- this . gameSocketConnectionTimestamp = null ;
319
316
} ;
320
317
321
318
private onGameProcessSocketError ( error : unknown ) {
322
319
logger . error ( 'WS:: game process socket error' , error ) ;
323
320
}
324
321
325
322
private onError = ( error : Error ) => {
323
+ // Ignore port already in use errors in CLI, it means the GUI is running and so the WS server too.
324
+ if ( process . env . PROCESS_NAME === 'cli' && 'code' in error && error . code === 'EADDRINUSE' ) {
325
+ return ;
326
+ }
327
+
326
328
logger . error ( 'WS:: an error occurred' ) ;
327
329
logger . error ( error ) ;
328
330
} ;
0 commit comments