Method: GameServer#on_tick
- Defined in:
- lib/game_server.rb
#on_tick ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/game_server.rb', line 110 def on_tick now = Time.now timeout_ids = [] @server.clients.each do |id, client| diff = now - client.last_recv_time timeout_ids.push(id) if diff > 10 end timeout_ids.each do |id| @server.drop_client(@server.clients[id], 'Timeout') end end |