def __init__(self, srcRoom, dstRoom, pillow):
        Peer.__init__(self, srcRoom)
        
        from wallaby.pf.room import House
        self._dstRoom = House.get(dstRoom)

        self._catch(pillow, self._message)
Example #2
0
 def __init__(self, peer_dict, torrent, tracker):
     self.tracker = tracker
     self.torrent = torrent
     Peer.__init__(self, peer_dict, torrent, peer_dict['id'])
     self.peers = []
     self.done = False
     self.piece_dict = { i : None for i in range(self.torrent.no_of_subpieces)}
Example #3
0
 def __init__(self, peer_dict, torrent, tracker):
     self.tracker = tracker
     self.torrent = torrent
     Peer.__init__(self, peer_dict, torrent, peer_dict['id'])
     self.peers = []
     self.done = False
     # The piece dictionary is to make sure I don't make multiple requests for the same piece to different peers
     self.piece_dict = { i : None for i in range(self.torrent.no_of_subpieces)}
Example #4
0
 def __init__(self, ip: str, id: int, api_url='R'):
     if len(ip) < 5:  # port only
         self.__IP = '127.0.0.1:' + ip
     else:
         self.__IP = ip
     self.__ID = id
     self.__socket.bind('tcp://' + self.__IP)
     Peer.__init__(self, ip, id, api_url)
     print('Validator constructed')
     self.join()
     self.listen()
Example #5
0
 def __init__(self, peer_dict, torrent, tracker):
     self.tracker = tracker
     self.torrent = torrent
     Peer.__init__(self, peer_dict, torrent, peer_dict['id'])
     self.peers = []
     self.done = False
     # The piece dictionary is to make sure I don't make multiple requests for the same piece to different peers
     self.piece_dict = {
         i: None
         for i in range(self.torrent.no_of_subpieces)
     }
Example #6
0
	def __init__(self, port, id, host = "127.0.0.1", bootstrap = True):
		Peer.__init__(self, id, port, host, False, True)
		handlers = {"TEST": self.__handle_test, 
					"PING": self.__handle_ping, 
					"PONG": self.__handle_pong,
					"BROADCAST": self.__handle_broadcast,
					"ADVERTISE": self.__handle_advt_peers,
					"ADVERTISE_REPLY": self.__handle_add_to_peers}
		for h in handlers:
			self.add_handler(h, handlers[h])

		self.recvd_messages = []

		if bootstrap:
			self.bootstrap(BOOTSTRAP_LIST)
Example #7
0
  def __init__(self, maxPeers, serverPort):
 
 
      Peer.__init__(self, maxPeers, serverPort)
      
      self.files = {}  # available files: name --> peerid mapping
  
      self.addRouter(self.__router)
  
      handlers = {LISTPEERS : self.__handle_listpeers,
              INSERTPEER : self.__handle_insertpeer,
              PEERNAME: self.__handle_peername,
              QUERY: self.__handle_query,
              QRESPONSE: self.__handle_qresponse,
              FILEGET: self.__handle_fileget,
              PEERQUIT: self.__handle_quit,
              SUPERPEER: self.__handle_superpeer
             }
      for mt in handlers:
          self.addHandler(mt, handlers[mt])
Example #8
0
 def __init__(self, peer_dict, torrent, brain):
     Peer.__init__(self, peer_dict, torrent, brain.my_id)
     self.brain = brain
	def __init__(self, name, transport=None):
		Peer.__init__(self, name, transport)
		self.age = 0
Example #10
0
 def __init__(self, peer_dict, torrent, brain):
     Peer.__init__(self, peer_dict, torrent, brain.my_id)
     self.brain = brain