Commit a079e998 authored by nanahira's avatar nanahira

fix CLIENT_kick during disconnected

parent 357cc4b9
...@@ -668,7 +668,11 @@ CLIENT_kick = global.CLIENT_kick = (client) -> ...@@ -668,7 +668,11 @@ CLIENT_kick = global.CLIENT_kick = (client) ->
client.system_kicked = true client.system_kicked = true
if settings.modules.reconnect.enabled and client.closed if settings.modules.reconnect.enabled and client.closed
if client.server and !client.had_new_reconnection if client.server and !client.had_new_reconnection
client.server.destroy() room = ROOM_all[room_id]
if room
room.disconnect(client)
else
client.server.destroy()
else else
client.destroy() client.destroy()
return true return true
...@@ -1537,7 +1541,7 @@ net.createServer (client) -> ...@@ -1537,7 +1541,7 @@ net.createServer (client) ->
room=ROOM_all[server.client.rid] room=ROOM_all[server.client.rid]
#log.info "server close", server.client.ip, ROOM_connected_ip[server.client.ip] #log.info "server close", server.client.ip, ROOM_connected_ip[server.client.ip]
room.disconnector = 'server' if room room.disconnector = 'server' if room
unless server.client.closed if server.client.closed
ygopro.stoc_send_chat(server.client, "${server_closed}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(server.client, "${server_closed}", ygopro.constants.COLORS.RED)
#if room and settings.modules.replay_delay #if room and settings.modules.replay_delay
# room.send_replays() # room.send_replays()
......
...@@ -843,13 +843,19 @@ ...@@ -843,13 +843,19 @@
}; };
CLIENT_kick = global.CLIENT_kick = function(client) { CLIENT_kick = global.CLIENT_kick = function(client) {
var room;
if (!client) { if (!client) {
return false; return false;
} }
client.system_kicked = true; client.system_kicked = true;
if (settings.modules.reconnect.enabled && client.closed) { if (settings.modules.reconnect.enabled && client.closed) {
if (client.server && !client.had_new_reconnection) { if (client.server && !client.had_new_reconnection) {
client.server.destroy(); room = ROOM_all[room_id];
if (room) {
room.disconnect(client);
} else {
client.server.destroy();
}
} }
} else { } else {
client.destroy(); client.destroy();
...@@ -1997,7 +2003,7 @@ ...@@ -1997,7 +2003,7 @@
if (room) { if (room) {
room.disconnector = 'server'; room.disconnector = 'server';
} }
if (!server.client.closed) { if (server.client.closed) {
ygopro.stoc_send_chat(server.client, "${server_closed}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(server.client, "${server_closed}", ygopro.constants.COLORS.RED);
CLIENT_kick(server.client); CLIENT_kick(server.client);
SERVER_clear_disconnect(server); SERVER_clear_disconnect(server);
......
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