Skip to content

Commit

Permalink
Better error management on debugger proxy conn.
Browse files Browse the repository at this point in the history
  * Listen for errors on the debugger proxy connections
  * Destroy debugger proxy connections after end.

Fixes #13
  • Loading branch information
stelcheck committed Nov 27, 2017
1 parent 7a65cd7 commit bf4d377
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ function closeDebuggerConnection() {

debuggerConnection.end();
localSocket.end();

debuggerConnection.destroy();
localSocket.destroy();
});

debuggerConnections = [];
Expand All @@ -293,6 +296,16 @@ net.createServer(function (localSocket) {
debuggerConnection.pipe(localSocket);
localSocket.pipe(debuggerConnection);

debuggerConnection.on('error', function (error) {
logger.warning('Error raised on the connection to the worker debug port', error);
closeDebuggerConnection();
});

localSocket.on('error', function (error) {
logger.warning('Error raised on the connection to the debugger proxy port', error);
closeDebuggerConnection();
});

debuggerConnections.push({ localSocket, debuggerConnection });
}).listen(debug.port);

Expand Down

0 comments on commit bf4d377

Please sign in to comment.