public void Test()
        {
            InvitationRequest request = new InvitationRequest(1111);
            this.TestFactory(request);

            InvitationAck ack = new InvitationAck(2222);
            this.TestFactory(ack);

            byte[] data = { 12, 34, 56 };
            FileDataResponse dataResponse = new FileDataResponse(data, 3333);
            this.TestFactory(dataResponse);

            FileEvent e1 = new FileEvent();
            e1.Name = "1234";
            List<FileEvent> lf = new List<FileEvent>();
            lf.Add(e1);
            PatchRequest patchRequest = new PatchRequest(lf, 4444);
            this.TestFactory(patchRequest);

            PeerList peerList = PeerList.GetPeerList("abc");
            peerList.AddPeer(new Peer("127.0.0.1", 5555));
            PeerListMessage pm = new PeerListMessage(peerList, 6666);
            this.TestFactory(pm);

            SyncAck syncAck = new SyncAck(7777);
            this.TestFactory(syncAck);

            SyncRequest syncRequest = new SyncRequest(8888);
            this.TestFactory(syncRequest);

            File.WriteAllText(".Distribox/VersionList.txt", "[]");
            VersionList vl = new VersionList();
            VersionListMessage vm = new VersionListMessage(vl, 9999);
            this.TestFactory(vm);
        }
예제 #2
0
 /// <summary>
 /// Process the peer list message and peer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="peer">The peer.</param>
 internal void Process(PeerListMessage message, Peer peer)
 {
     lock (this.peers)
     {
         this.peers.AddPeer(peer);
         this.peers.MergeWith(message.List);
     }
 }
예제 #3
0
 /// <summary>
 /// Process the peer list message and peer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="peer">The peer.</param>
 internal void Process(PeerListMessage message, Peer peer)
 {
     lock (this.peers)
     {
         this.peers.AddPeer(peer);
         this.peers.MergeWith(message.List);
     }
 }