Commit f3955c2b authored by nanahira's avatar nanahira

apply flush data to reconnect for improve

parent fa26e4c8
...@@ -831,7 +831,7 @@ CLIENT_heartbeat_unregister = (client) -> ...@@ -831,7 +831,7 @@ CLIENT_heartbeat_unregister = (client) ->
return true return true
CLIENT_heartbeat_register = (client, send) -> CLIENT_heartbeat_register = (client, send) ->
if !settings.modules.heartbeat_detection.enabled or client.closed or client.is_post_watcher or client.pre_reconnecting or client.reconnecting or client.waiting_for_last or client.pos > 3 or client.heartbeat_protected if !settings.modules.heartbeat_detection.enabled or client.closed or client.is_post_watcher or client.pre_reconnecting or client.reconnecting or client.pos > 3 or client.heartbeat_protected
return false return false
if client.heartbeat_timeout if client.heartbeat_timeout
CLIENT_heartbeat_unregister(client) CLIENT_heartbeat_unregister(client)
...@@ -2435,13 +2435,15 @@ ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)-> ...@@ -2435,13 +2435,15 @@ ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)->
ygopro.ctos_follow 'REQUEST_FIELD', true, (buffer, info, client, server)-> ygopro.ctos_follow 'REQUEST_FIELD', true, (buffer, info, client, server)->
return true return true
ygopro.stoc_follow 'FIELD_FINISH', true, (buffer, info, client, server)-> ygopro.stoc_follow 'FIELD_FINISH', true, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
return true unless room and settings.modules.reconnect.enabled return true unless room and settings.modules.reconnect.enabled
client.reconnecting = false client.reconnecting = false
if client.time_confirm_required # client did not send TIME_CONFIRM #if client.time_confirm_required # client did not send TIME_CONFIRM
client.waiting_for_last = true # client.waiting_for_last = true
else if client.last_game_msg and client.last_game_msg_title != 'WAITING' # client sent TIME_CONFIRM #else
if client.last_game_msg and client.last_game_msg_title != 'WAITING' # client sent TIME_CONFIRM
SOCKET_flush_data(client, datas)
if client.last_hint_msg if client.last_hint_msg
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg) ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg)
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg) ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg)
...@@ -2902,12 +2904,12 @@ ygopro.ctos_follow 'TIME_CONFIRM', false, (buffer, info, client, server)-> ...@@ -2902,12 +2904,12 @@ ygopro.ctos_follow 'TIME_CONFIRM', false, (buffer, info, client, server)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
return unless room return unless room
if settings.modules.reconnect.enabled if settings.modules.reconnect.enabled
if client.waiting_for_last #if client.waiting_for_last
client.waiting_for_last = false # client.waiting_for_last = false
if client.last_game_msg and client.last_game_msg_title != 'WAITING' # if client.last_game_msg and client.last_game_msg_title != 'WAITING'
if client.last_hint_msg # if client.last_hint_msg
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg) # ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg)
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg) # ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg)
client.time_confirm_required = false client.time_confirm_required = false
if settings.modules.heartbeat_detection.enabled if settings.modules.heartbeat_detection.enabled
client.heartbeat_protected = false client.heartbeat_protected = false
......
...@@ -1065,7 +1065,7 @@ ...@@ -1065,7 +1065,7 @@
}; };
CLIENT_heartbeat_register = function(client, send) { CLIENT_heartbeat_register = function(client, send) {
if (!settings.modules.heartbeat_detection.enabled || client.closed || client.is_post_watcher || client.pre_reconnecting || client.reconnecting || client.waiting_for_last || client.pos > 3 || client.heartbeat_protected) { if (!settings.modules.heartbeat_detection.enabled || client.closed || client.is_post_watcher || client.pre_reconnecting || client.reconnecting || client.pos > 3 || client.heartbeat_protected) {
return false; return false;
} }
if (client.heartbeat_timeout) { if (client.heartbeat_timeout) {
...@@ -3022,16 +3022,15 @@ ...@@ -3022,16 +3022,15 @@
return true; return true;
}); });
ygopro.stoc_follow('FIELD_FINISH', true, function(buffer, info, client, server) { ygopro.stoc_follow('FIELD_FINISH', true, function(buffer, info, client, server, datas) {
var room; var room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!(room && settings.modules.reconnect.enabled)) { if (!(room && settings.modules.reconnect.enabled)) {
return true; return true;
} }
client.reconnecting = false; client.reconnecting = false;
if (client.time_confirm_required) { if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
client.waiting_for_last = true; SOCKET_flush_data(client, datas);
} else if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
if (client.last_hint_msg) { if (client.last_hint_msg) {
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg); ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg);
} }
...@@ -3672,15 +3671,6 @@ ...@@ -3672,15 +3671,6 @@
return; return;
} }
if (settings.modules.reconnect.enabled) { if (settings.modules.reconnect.enabled) {
if (client.waiting_for_last) {
client.waiting_for_last = false;
if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
if (client.last_hint_msg) {
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg);
}
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg);
}
}
client.time_confirm_required = false; client.time_confirm_required = false;
} }
if (settings.modules.heartbeat_detection.enabled) { if (settings.modules.heartbeat_detection.enabled) {
......
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