Beispiel #1
0
        private void HandlePeerKeepAliveRequest(object sender, PacketEventArgs e)
        {
            //Console.WriteLine("Got peer keep alive request {0}", pkt);
            Radio  r    = this.FindRadioByPacket(e.packet, e.ep);
            Packet resp = new PeerKeepAliveReply(this.myID, this.type);

            if (r == null)
            {
                //Console.WriteLine("Replying to unknown radio...");
                this.client.Send(resp, e.ep);
            }
            else
            {
                //Console.WriteLine("Replying to known radio {0}", r);
                r.SendPacket(resp);
            }
        }
Beispiel #2
0
        private void HandlePeerRegisterRequest(object sender, PacketEventArgs e)
        {
            //Console.WriteLine("Got register request {0}", pkt);
            Radio  r    = this.FindRadioByPacket(e.packet, e.ep);
            Packet resp = new PeerRegistrationReply(this.myID, this.type);

            if (r == null)
            {
                //Console.WriteLine("Replying to unknown radio...");
                this.client.Send(resp, e.ep);
            }
            else
            {
                //Console.WriteLine("Replying to known radio {0}", r);
                if (r.ID == null)
                {
                    //Console.WriteLine("Updating Radio ID {0}", e.packet.ID);
                    r.ID = e.packet.ID;
                }
                r.SendPacket(resp);
            }
        }