Skip to content

Commit 28239f4

Browse files
committed
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
1 parent a50ebdd commit 28239f4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ var start = function(injector, config, launcher, globalEmitter, preprocess, file
197197
// TODO(vojta): change the client to not send the event (if disconnected by purpose)
198198
var sockets = socketServer.sockets.sockets;
199199
Object.getOwnPropertyNames(sockets).forEach(function(key) {
200-
sockets[key].removeAllListeners('disconnect');
200+
var socket = sockets[key];
201+
socket.removeAllListeners('disconnect');
202+
if (!socket.disconnected) {
203+
socket.disconnect();
204+
}
201205
});
202206

203207
var removeAllListenersDone = false;

0 commit comments

Comments
 (0)