Exemplo n.º 1
0
        public void Receive(Message.Message message)
        {
            var messageKey = message.Key(0);
            IDictionary <Number640, Data> dataMap;

            if (message.DataMap(0) != null)
            {
                dataMap = message.DataMap(0).BackingDataMap;
            }
            else
            {
                dataMap = null;
            }
            int hopCount = message.IntAt(0);

            if (TwiceSeen(messageKey))
            {
                return;
            }
            Logger.Debug("Got broadcast map {0} from {1}.", dataMap, _peer.PeerId);
            lock (DebugCounter)
            {
                DebugCounter.Add(_peer.PeerId);
            }
            if (hopCount < MaxHopCount)
            {
                if (hopCount == 0)
                {
                    FirstPeer(messageKey, dataMap, hopCount, message.IsUdp);
                }
                else
                {
                    OtherPeer(messageKey, dataMap, hopCount, message.IsUdp);
                }
            }
        }