Timeout clients that did not sent for 10s
This commit is contained in:
parent
821036fba4
commit
c770695f22
|
@ -87,7 +87,7 @@ class GameServer
|
||||||
timeout_ids = []
|
timeout_ids = []
|
||||||
@server.clients.each do |id, client|
|
@server.clients.each do |id, client|
|
||||||
diff = now - client.last_recv_time
|
diff = now - client.last_recv_time
|
||||||
timeout_ids.push(id) if diff > 1
|
timeout_ids.push(id) if diff > 10
|
||||||
end
|
end
|
||||||
|
|
||||||
timeout_ids.each do |id|
|
timeout_ids.each do |id|
|
||||||
|
|
|
@ -287,6 +287,7 @@ class TeeworldsServer
|
||||||
@clients.each do |id, client|
|
@clients.each do |id, client|
|
||||||
next unless packet.addr.eq(client.addr)
|
next unless packet.addr.eq(client.addr)
|
||||||
|
|
||||||
|
client.last_recv_time = Time.now
|
||||||
packet.client_id = id
|
packet.client_id = id
|
||||||
packet.client = client
|
packet.client = client
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue