/usr/lib/python2.7/dist-packages/ccnet/async/timer.py is in libccnet0 6.0.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import libevent
import logging
class Timer(object):
'''Wraps aroud a libevent timeout event'''
def __init__(self, ev_base, timeout):
self._timeout = timeout
self._evtimer = libevent.Timer(ev_base, self._callback, None)
self._evtimer.add(timeout) # pylint: disable=E1101
def _callback(self, evtimer, user_data):
dummy = user_data
try:
self.callback()
except:
logging.exception('error in timer callback:')
evtimer.add(self._timeout)
def callback(self):
raise NotImplementedError
|