diff --git a/events.py b/events.py index 644cb721aa..958fd3b0eb 100644 --- a/events.py +++ b/events.py @@ -1,15 +1,17 @@ +import session_mgr + """ Holds the events scheduled in scheduler.py. """ schedule = { - 'event_example': 60, + 'check_sessions': 60, } lastrun = {} -def event_example(): +def check_sessions(): """ - This is where the example event would be placed. + Check all of the connected sessions. """ - pass + session_mgr.check_all_sessions() diff --git a/scheduler.py b/scheduler.py index efcb72be95..4dfdd895ec 100644 --- a/scheduler.py +++ b/scheduler.py @@ -5,7 +5,7 @@ A really simple scheduler. We can probably get a lot fancier with this in the future, but it'll do for now. ADDING AN EVENT: -* Add an entry to the 'schedule' dictionary. +* Add an entry to the 'schedule' dictionary in the 'events' file. * Add the proper event_ function here. * Profit. """ diff --git a/session_mgr.py b/session_mgr.py index 93b44736d1..27acba49c7 100644 --- a/session_mgr.py +++ b/session_mgr.py @@ -19,6 +19,17 @@ def get_session_list(): Lists the connected session objects. """ return session_list + +def check_all_sessions(): + """ + Check all currently connected sessions and see if any are dead. + """ + for sess in get_session_list(): + if not sess.writable() or not sess.readable(): + print 'Problematic Session:' + print 'Readable ', sess.readable() + print 'Writable ', sess.writable() + def remove_session(session): """