From 194b28b90fa2172004a53a55747718dfaea5f63c Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 1 Feb 2013 01:06:33 +0100 Subject: [PATCH] Added check_unused_connections on startup. --- script/websocket-server.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/script/websocket-server.rb b/script/websocket-server.rb index 9c0d65922..0d11df95d 100644 --- a/script/websocket-server.rb +++ b/script/websocket-server.rb @@ -58,9 +58,6 @@ $daemon_pid.close EventMachine.run { EventMachine::WebSocket.start( :host => @options[:b], :port => @options[:p], :secure => @options[:s], :tls_options => tls_options ) do |ws| - # check unused connections - check_unused_connections - # register client connection ws.onopen { client_id = ws.object_id @@ -185,6 +182,11 @@ EventMachine.run { } end + # check unused connections + EventMachine.add_timer(0.5) { + check_unused_connections + } + # check open unused connections, kick all connection without activitie in the last 2 minutes EventMachine.add_periodic_timer(120) { check_unused_connections