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) ->
return true
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
if client.heartbeat_timeout
CLIENT_heartbeat_unregister(client)
......@@ -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)->
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]
return true unless room and settings.modules.reconnect.enabled
client.reconnecting = false
if client.time_confirm_required # client did not send TIME_CONFIRM
client.waiting_for_last = true
else if client.last_game_msg and client.last_game_msg_title != 'WAITING' # client sent TIME_CONFIRM
#if client.time_confirm_required # client did not send TIME_CONFIRM
# client.waiting_for_last = true
#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
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_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)->
room=ROOM_all[client.rid]
return unless room
if settings.modules.reconnect.enabled
if client.waiting_for_last
client.waiting_for_last = false
if client.last_game_msg and 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)
#if client.waiting_for_last
# client.waiting_for_last = false
# if client.last_game_msg and 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
if settings.modules.heartbeat_detection.enabled
client.heartbeat_protected = false
......
......@@ -1065,7 +1065,7 @@
};
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;
}
if (client.heartbeat_timeout) {
......@@ -3022,16 +3022,15 @@
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;
room = ROOM_all[client.rid];
if (!(room && settings.modules.reconnect.enabled)) {
return true;
}
client.reconnecting = false;
if (client.time_confirm_required) {
client.waiting_for_last = true;
} else if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
SOCKET_flush_data(client, datas);
if (client.last_hint_msg) {
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg);
}
......@@ -3672,15 +3671,6 @@
return;
}
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;
}
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