Added idle timeout code to help combat the screwed up session situation. Some admins would've wanted this eventually, but it'll help until I figure out how to close dead sessions that look like they're still alive. Added a new server config directive, idle_timeout. If the value is non-zero, the idle timeout is the respective number of seconds between commands. Also, the IDLE command will save you from idle timeouts but won't modify your publicly visible idle time.
This commit is contained in:
parent
32fa9e419a
commit
f1dd985294
6 changed files with 34 additions and 11 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import time
|
||||
from session import PlayerSession
|
||||
import gameconf
|
||||
|
||||
"""
|
||||
Session manager, handles connected players.
|
||||
|
|
@ -24,8 +26,18 @@ def check_all_sessions():
|
|||
"""
|
||||
Check all currently connected sessions and see if any are dead.
|
||||
"""
|
||||
pass
|
||||
#for sess in get_session_list():
|
||||
idle_timeout = int(gameconf.get_configvalue('idle_timeout'))
|
||||
|
||||
if len(session_list) <= 0:
|
||||
return
|
||||
|
||||
if idle_timeout <= 0:
|
||||
return
|
||||
|
||||
for sess in get_session_list():
|
||||
if (time.time() - sess.cmd_last) > idle_timeout:
|
||||
sess.msg("Idle timeout exceeded, disconnecting.")
|
||||
sess.handle_close()
|
||||
## This doesn't seem to provide an accurate indication of timed out
|
||||
## sessions.
|
||||
#if not sess.writable() or not sess.readable():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue