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:
Greg Taylor 2007-05-09 15:28:12 +00:00
parent 32fa9e419a
commit f1dd985294
6 changed files with 34 additions and 11 deletions

View file

@ -25,6 +25,8 @@ class PlayerSession(async_chat):
self.logged_in = False
# The time the user last issued a command.
self.cmd_last = time.time()
# Player-visible idle time, excluding the IDLE command.
self.cmd_last_visible = time.time()
# Total number of commands issued.
self.cmd_total = 0
# The time when the user connected.
@ -46,10 +48,6 @@ class PlayerSession(async_chat):
uinput = line
self.data = []
# Increment our user's command counter.
self.cmd_total += 1
# Store the timestamp of the user's last command.
self.cmd_last = time.time()
# Stuff anything we need to pass in this dictionary.
cdat = {"server": self.server, "uinput": uinput, "session": self}
cmdhandler.handle(cdat)