|
@@ -345,10 +345,17 @@ module InterconnectionPointProtocolHandler
|
|
|
|
|
|
if line
|
|
if line
|
|
|
|
|
|
|
|
+
|
|
if entered_username? # oh, it's a known user
|
|
if entered_username? # oh, it's a known user
|
|
- # it's alive!
|
|
|
|
- inputter = inputting(line)
|
|
|
|
|
|
|
|
|
|
+ # it's alive! kill ping timer, set a new one:
|
|
|
|
+ if @ping_timer
|
|
|
|
+ EventMachine.cancel_timer(@ping_timer)
|
|
|
|
+ end
|
|
|
|
+ @ping_timer = EventMachine.add_periodic_timer 90, proc { write_user("PING alive?") }
|
|
|
|
+
|
|
|
|
+ # work on input
|
|
|
|
+ inputter = inputting(line)
|
|
if inputter == "bye"
|
|
if inputter == "bye"
|
|
close_connection
|
|
close_connection
|
|
end
|
|
end
|
|
@@ -397,7 +404,9 @@ module InterconnectionPointProtocolHandler
|
|
def unbind # a connection goes bye bye
|
|
def unbind # a connection goes bye bye
|
|
if @username
|
|
if @username
|
|
@@connected_clients.delete(self)
|
|
@@connected_clients.delete(self)
|
|
- EventMachine.cancel_timer(@ping_timer)
|
|
|
|
|
|
+ if @ping_timer
|
|
|
|
+ EventMachine.cancel_timer(@ping_timer)
|
|
|
|
+ end
|
|
|
|
|
|
put_log "SYS '#{@username}' disconnected."
|
|
put_log "SYS '#{@username}' disconnected."
|
|
end
|
|
end
|