Added check_unused_connections on startup.

This commit is contained in:
Martin Edenhofer 2013-02-01 01:06:33 +01:00
parent b496440333
commit 194b28b90f

View file

@ -58,9 +58,6 @@ $daemon_pid.close
EventMachine.run { EventMachine.run {
EventMachine::WebSocket.start( :host => @options[:b], :port => @options[:p], :secure => @options[:s], :tls_options => tls_options ) do |ws| 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 # register client connection
ws.onopen { ws.onopen {
client_id = ws.object_id client_id = ws.object_id
@ -185,6 +182,11 @@ EventMachine.run {
} }
end 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 # check open unused connections, kick all connection without activitie in the last 2 minutes
EventMachine.add_periodic_timer(120) { EventMachine.add_periodic_timer(120) {
check_unused_connections check_unused_connections