def SendHandshake(self, request, context): handshake = pickle.loads(request.message) print("HANDSHAKING" + handshake.addrMe) if handshake.addrMe not in self.peers: self.peers.append(handshake.addrMe) for x in self.peers: print("known nodes:" + str(x)) print("Peers: " + str(self.peers)) return helloworld_pb2.KnownPeerList(message=self.peers)
def PullPeers(self, request, context): return helloworld_pb2.KnownPeerList(message=self.peers)