public void Begin(DistributedRoutingTable table)
        {
            this.table = table;
            callback = table.GetConsumer<Callback>(Callback.CONSUMER_ID);

            BeginReceive(CreateEatPacket(table));
        }
示例#2
0
        private static void ParsePing(BinaryReader reader)
        {
            UdpContact c = ReadContact(reader);

            long tokenId = IPAddress.NetworkToHostOrder(reader.ReadInt64());

            localTable.DeliverPing(c);

            var callback = localTable.GetConsumer <Callback>(Callback.CONSUMER_ID);

            callback.SendResponse(localTable.LocalContact, c, tokenId, new byte[] { 1, 3, 3, 7 });
        }
 private void FindTable(DistributedRoutingTable start, DistributedRoutingTable end)
 {
     var closest = start.GetConsumer<GetClosestNodes>(GetClosestNodes.GUID).GetClosestContacts(end.LocalIdentifier).First();
     if (closest.NetworkId != end.NetworkId) throw new Exception("Incorrect network GUID");
     if (closest.Identifier != end.LocalIdentifier) throw new Exception("Incorrect table");
 }