def init_start(self, tracker, torrent_hash, time, option, file=None): """ Metodo para inicializar el peer :param tracker: tracker :param torrent_hash: id torrent :param time: tiempo para parar el peer :param option: opcion a ejecutar :param file: fichero """ if (option >= 1) and (option <= 3): self._set_tracker(tracker) self._set_torrent_hash(torrent_hash) self.option = option self.file = file if not self._KEY_DATA in self.torrent: self.torrent[self._KEY_DATA] = {} if ((option == self._KEY_PULL_ACTION) or (option == self._KEY_PUSH_PULL_ACTION)) and (not self.seed): self._init_structs() self.announce__set_peers_interval = interval( self.host, 5, self.proxy, 'announce_set_peers') if option == self._KEY_PUSH_ACTION: self.push_interval = interval(self.host, 1, self.proxy, 'push') elif option == self._KEY_PULL_ACTION: if not self.seed: # if not seed self.pull_interval = interval(self.host, 1, self.proxy, 'pull') else: self.push_interval = interval(self.host, 1, self.proxy, 'push') if not self.seed: self.pull_interval = interval(self.host, 1, self.proxy, 'pull') self.result_interval = interval(self.host, 1, self.proxy, 'save_result') later(time, self.proxy, 'stop_interval')
def init_start(self, torrent): self.peerAnounce = interval(h, 6, self.proxy, "announce", t, torrent) self.peerPush = interval(h, 1, self.proxy, "pushGossip", torrent) if self.proxy != ps: self.peerPull = interval(h, 1, self.proxy, "pullGossip", torrent) later(60, self.proxy, "stop_interval")
def inicia_gossip_pull(self): self.n_cicles = 0 self.interval = interval( self.host, 5, self.proxy, 'stay_alive') #Interval de announce al tracker self.interval_pull = interval(self.host, 1, self.proxy, 'make_pull') #Interval de gossip pull later(7, self.proxy, 'genera_graf', 'Metode Pull', 'GraficPull') #Despres de 7 cicles fem grafic
def inicia_gossip_push(self): #Inicia proces de gossip amb metode Push self.n_cicles = 0 self.interval = interval( self.host, 5, self.proxy, 'stay_alive') #Ens anunciem en un interval continu self.interval_push = interval( self.host, 1, self.proxy, 'make_push') #Realitzem un cicle de gossip cada segon later(24, self.proxy, 'genera_graf', 'Metode Push', 'GraficPush')
def init_start(self): self.interval1 = interval(self.host, 1, self.proxy, "hello", "you") later(5, self.proxy, "stop_interval")
def init_hybrid(self): self.cycle = 0 self.interval = interval(self.host, 3, self.proxy, 'announce_me') self.interval_hybrid = interval(self.host, 1, self.proxy, 'make_hybrid') later(20, self.proxy, 'make_graph', 'Hybrid', 'hybrid')
def init_pull(self): self.cycle = 0 self.interval = interval(self.host, 3, self.proxy, 'announce_me') self.interval_pull = interval(self.host, 1, self.proxy, 'make_pull') later(20, self.proxy, 'make_graph', 'Pull', 'pull')
def init_start(self): self.interval = interval(self.host, 3, self.proxy, 'announce_me') later(5, self.proxy, 'stop_interval')
def init_start(self): self.timeCheck = interval(h,1, self.proxy, "trackerTimeCheck") later(300, self.proxy, "stop_interval")
def init_start(self, hostPeer): self.peerAnounce = interval(hostPeer, 3, self.proxy, "announce") later(300, self.proxy, "stop_interval")
def init_start(self, torrent): self.timeCheck = interval(h, 1, self.proxy, "trackerTimeCheck", torrent) later(60, self.proxy, "stop_interval")
def _init_start(self, later_time, interval_time=None): if not interval_time: interval_time = self.EXP_TIME self.exp_interval = interval(self.host, interval_time, self.proxy, '_expel_inactive_peers') later(later_time, self.proxy, 'stop_interval')