Skip to content

Commit

Permalink
fix(server): Force clients disconnect on Windows
Browse files Browse the repository at this point in the history
It occurs that only on Windows, socket.io clients are not properly disconnected, which causes Karma to not exit immediately when everything is done. We have to wait for some internal disconnection socket.io event timeout.

This PR basically check if all sockets are disconnected. If not we manually force the disconnection.

Fixes #1109
  • Loading branch information
bcharbonnier committed Jul 1, 2014
1 parent a50ebdd commit 28239f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ var start = function(injector, config, launcher, globalEmitter, preprocess, file
// TODO(vojta): change the client to not send the event (if disconnected by purpose)
var sockets = socketServer.sockets.sockets;
Object.getOwnPropertyNames(sockets).forEach(function(key) {
sockets[key].removeAllListeners('disconnect');
var socket = sockets[key];
socket.removeAllListeners('disconnect');
if (!socket.disconnected) {
socket.disconnect();
}
});

var removeAllListenersDone = false;
Expand Down

0 comments on commit 28239f4

Please sign in to comment.