Add more safeguards for socket errors
This commit is contained in:
parent
cd22570c40
commit
414cbfdc5d
3 changed files with 37 additions and 11 deletions
|
|
@ -217,7 +217,15 @@ module.exports = {
|
|||
if (id in srv.servers) {
|
||||
io.attach(srv.servers[id]);
|
||||
} else {
|
||||
io.attach(require("http").createServer().listen(bind.port, bind.ip));
|
||||
var server = require("http").createServer().listen(bind.port, bind.ip);
|
||||
server.on("clientError", function (err, socket) {
|
||||
Logger.errlog.log("clientError on " + id + " - " + err);
|
||||
try {
|
||||
socket.destroy();
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
io.attach(server);
|
||||
}
|
||||
|
||||
bound[id] = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue