Ejemplo n.º 1
0
        private void respondPeerDiscovery(NetworkPacket packet)
        {
            PeerDiscoveryMsg request = new PeerDiscoveryMsg();
            request.Deserialize(packet.Data);

            // process incoming peer list
            processNewPeerList(request.knownPeers);

            // send message with own peer list
            Hash token = packet.Token;
            Hash peer = packet.PublicKeySource;
            PeerDiscoveryMsg response = new PeerDiscoveryMsg();
            response.knownPeers = KnownPeers;
            byte[] message = response.Serialize();
            NetworkPacket newpacket = new NetworkPacket(nodeConfig.PublicKey, PacketType.TPT_PEER_DISCOVERY_RESPONSE, message, token);
            networkPacketSwitch.AddToQueue(peer, newpacket);
        }
Ejemplo n.º 2
0
 private void processPeerDiscovery(NetworkPacket packet)
 {
     if (packet.Token == requestToken)
     {
         PeerDiscoveryMsg response = new PeerDiscoveryMsg();
         response.Deserialize(packet.Data);
         processNewPeerList(response.knownPeers);
     }
     else
     {
         Print("toke mismatch");
     }
 }