def __init__(self, trsession): super(LibtorrentMgr, self).__init__() self._logger = logging.getLogger(self.__class__.__name__) self.trsession = trsession self.ltsessions = {} self.ltsession_metainfo = None self.notifier = trsession.notifier self.set_upload_rate_limit(0) self.set_download_rate_limit(0) self.torrents = {} self.upnp_mapping_dict = {} self.dht_ready = False self.metadata_tmpdir = None self.metainfo_requests = {} self.metainfo_lock = threading.RLock() self.metainfo_cache = {} self.process_alerts_lc = self.register_task( "process_alerts", LoopingCall(self._task_process_alerts)) self.check_reachability_lc = self.register_task( "check_reachability", LoopingCall(self._check_reachability))
def __init__(self, tribler_session): super(LibtorrentMgr, self).__init__() self._logger = logging.getLogger(self.__class__.__name__) self.tribler_session = tribler_session self.ltsessions = {} self.ltsession_metainfo = None self.notifier = tribler_session.notifier self.set_upload_rate_limit(0) self.set_download_rate_limit(0) self.torrents = {} self.upnp_mapping_dict = {} self.dht_ready = False self.metadata_tmpdir = None self.metainfo_requests = {} self.metainfo_lock = threading.RLock() self.metainfo_cache = {} self.process_alerts_lc = self.register_task( "process_alerts", LoopingCall(self._task_process_alerts)) self.check_reachability_lc = self.register_task( "check_reachability", LoopingCall(self._check_reachability)) self.default_alert_mask = lt.alert.category_t.stats_notification | lt.alert.category_t.error_notification | \ lt.alert.category_t.status_notification | lt.alert.category_t.storage_notification | \ lt.alert.category_t.performance_warning | lt.alert.category_t.tracker_notification self.alert_callback = None
def initialize(self): """ Initializes the TFTP service. We create a UDP socket and a server session. """ self._endpoint.listen_to(self._prefix, self.data_came_in) # start a looping call that checks timeout self.register_task(u"tftp timeout check", LoopingCall(self._task_check_timeout)).start( self._timeout_check_interval, now=True) self._is_running = True
def initialize(self): # start upnp self.get_session().start_upnp() # make temporary directory for metadata collecting through DHT self.metadata_tmpdir = tempfile.mkdtemp(suffix=u'tribler_metainfo_tmpdir') # register tasks self.process_alerts_lc.start(1, now=False) self.check_reachability_lc.start(5, now=True) self._schedule_next_check(5, DHT_CHECK_RETRIES) self.register_task(u'task_cleanup_metacache', LoopingCall(self._task_cleanup_metainfo_cache)).start(60, now=True)