mirror of
https://github.com/evennia/evennia.git
synced 2026-03-27 10:16:32 +01:00
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,5 @@
|
|||
from traceback import format_exc
|
||||
import time
|
||||
import commands_privileged
|
||||
import commands_general
|
||||
import commands_unloggedin
|
||||
|
|
@ -58,9 +59,18 @@ def handle(cdat):
|
|||
parsed_input['root_cmd'] = alias_list.get(parsed_input['root_cmd'],parsed_input['root_cmd'])
|
||||
|
||||
if session.logged_in:
|
||||
# Store the timestamp of the user's last command.
|
||||
session.cmd_last = time.time()
|
||||
|
||||
# Lets the users get around badly configured NAT timeouts.
|
||||
if parsed_input['root_cmd'] == 'idle':
|
||||
return
|
||||
|
||||
# Increment our user's command counter.
|
||||
session.cmd_total += 1
|
||||
# Player-visible idle time, not used in idle timeout calcs.
|
||||
session.cmd_last_visible = time.time()
|
||||
|
||||
# If it's prefixed by an '@', it's a staff command.
|
||||
if parsed_input['root_cmd'][0] != '@':
|
||||
# Shortened say alias.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue