X-Git-Url: https://git.llucax.com/software/pymin.git/blobdiff_plain/7d2f3da6aee023c991c9669a6a4664bd8be53a97..dd459a6147ed4f4fe3bfcbde4dda8e8ebcc979ad:/pymin/pymindaemon.py diff --git a/pymin/pymindaemon.py b/pymin/pymindaemon.py index f749753..8ed3f15 100644 --- a/pymin/pymindaemon.py +++ b/pymin/pymindaemon.py @@ -37,7 +37,7 @@ class PyminDaemon(eventloop.EventLoop): >>> PyminDaemon(Root(), ('', 9999)).run() """ - def __init__(self, root, bind_addr=('', 9999)): + def __init__(self, root, bind_addr=('', 9999), timer=1): r"""Initialize the PyminDaemon object. See PyminDaemon class documentation for more info. @@ -47,7 +47,7 @@ class PyminDaemon(eventloop.EventLoop): sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(bind_addr) # Create EventLoop - eventloop.EventLoop.__init__(self, sock) + eventloop.EventLoop.__init__(self, sock, timer=timer) # Create Dispatcher #TODO root.pymin = PyminHandler() self.dispatcher = dispatcher.Dispatcher(root) @@ -84,6 +84,10 @@ class PyminDaemon(eventloop.EventLoop): response += u'%d\n%s' % (len(result), result) self.file.sendto(response.encode('utf-8'), addr) + def handle_timer(self): + r"handle_timer() -> None :: Call handle_timer() on handlers." + self.dispatcher.root.handle_timer() + def run(self): r"run() -> None :: Run the event loop (shortcut to loop())" try: