Commit 1e2d650b authored by Leo Iannacone's avatar Leo Iannacone

close all watchers on client disconnection

parent b51983a1
......@@ -73,9 +73,5 @@ var server = app.listen(config.port, config.host, null, function(){
client.send_status(status)
});
io.sockets.on('disconnect', function(socket){
});
console.log("Debomatic-webui listening on %s:%d in %s mode", app.address().address, app.address().port, app.settings.env);
});
......@@ -162,6 +162,20 @@ function Client (socket) {
return
__handler_get_file(socket, data)
})
// on client disconnection close all watchers
socket.on('disconnect', function() {
socket.get("watchers", function(err, socket_watchers){
if (! socket_watchers)
return;
for (key in socket_watchers) {
try { socket_watchers[key].close() }
catch (err) {}
}
})
});
}
this.send_status = function(status) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment