Merge pull request #2108 from thelounge/xpaw/socket-closed

Log socket close error if any
This commit is contained in:
Pavel Djundik 2018-02-27 13:14:30 +02:00 committed by GitHub
commit 92eb45a6f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,7 +78,7 @@ module.exports = function(irc, network) {
identSocketId = client.manager.identHandler.addSocket(socket, client.name || network.username); identSocketId = client.manager.identHandler.addSocket(socket, client.name || network.username);
}); });
irc.on("socket close", function() { irc.on("socket close", function(error) {
if (identSocketId > 0) { if (identSocketId > 0) {
client.manager.identHandler.removeSocket(identSocketId); client.manager.identHandler.removeSocket(identSocketId);
identSocketId = 0; identSocketId = 0;
@ -88,6 +88,13 @@ module.exports = function(irc, network) {
chan.state = Chan.State.PARTED; chan.state = Chan.State.PARTED;
}); });
if (error) {
network.channels[0].pushMessage(client, new Msg({
type: Msg.Type.ERROR,
text: `Connection closed unexpectedly: ${error}`,
}), true);
}
sendStatus(); sendStatus();
}); });