def keep_the_buffer_full(self): # {{{ Peer_IMS.keep_the_buffer_full(self) if (self.played_chunk % self.debt_memory) == 0: for i in self.debt: self.debt[i] /= 2
def buffer_data(self): # {{{ # Number of times that the previous received chunk has been sent # to the team. If this counter is smaller than the number # of peers in the team, the previous chunk must be sent in the # burst mode because a new chunk from the splitter has arrived # and the previous received chunk has not been sent to all the # peers of the team. This can happen when one or more chunks # that were routed towards this peer have been lost. self.receive_and_feed_counter = 0 # This "private and static" variable holds the previous chunk # received from the splitter. It is used to send the previous # received chunk in the congestion avoiding mode. In that # mode, the peer sends a chunk only when it received a chunk # from another peer or from the splitter. self.receive_and_feed_previous = "" self.sendto_counter = 0 self.debt_memory = 1 << self.MAX_CHUNK_DEBT Peer_IMS.buffer_data(self)
def run(self): # {{{ #Peer_IMS.peers_life(self) Peer_IMS.run(self) self.polite_farewell()