Skip to content
Permalink
Browse files

fix(server): Force clients disconnect on Windows

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 28239f420460bdb9dd3b71f8088a0dfc1277dca6
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/server.js
@@ -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;

0 comments on commit 28239f4

Please sign in to comment.
You can’t perform that action at this time.