Get network loop tracking working.
This commit is contained in:
		@@ -77,6 +77,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
        public List<NetShape> Shapes = new List<NetShape>(); //For storing simple shapes which are drawn on the network
 | 
			
		||||
        public bool IsRandomNetwork = false;
 | 
			
		||||
        public bool InShapeEditMode = false;
 | 
			
		||||
        public bool HadLoop = false;
 | 
			
		||||
 | 
			
		||||
        private List<AnimationClass> Animations = new List<AnimationClass>();
 | 
			
		||||
 | 
			
		||||
@@ -837,7 +838,9 @@ namespace EduNetworkBuilder
 | 
			
		||||
            {
 | 
			
		||||
                if (nt.sHost == Source && !nt.TestComplete())
 | 
			
		||||
                {
 | 
			
		||||
                    if (WhatFor == ContextTest.ping && (nt.TheTest == NetTestType.FailedPing || nt.TheTest == NetTestType.SuccessfullyPings 
 | 
			
		||||
                    if (WhatFor == ContextTest.ping && (nt.TheTest == NetTestType.FailedPing 
 | 
			
		||||
                        || nt.TheTest == NetTestType.SuccessfullyPings
 | 
			
		||||
                        || nt.TheTest == NetTestType.SuccessfullyPingsWithoutLoop
 | 
			
		||||
                        || nt.TheTest == NetTestType.SuccessfullyPingsAgain))
 | 
			
		||||
                        tDests.Add(nt.dHost);
 | 
			
		||||
                    if (WhatFor == ContextTest.arp && nt.TheTest == NetTestType.SuccessfullyArps)
 | 
			
		||||
@@ -1341,6 +1344,10 @@ namespace EduNetworkBuilder
 | 
			
		||||
                    nt.SetDone(PacketID);
 | 
			
		||||
                if (nt.TheTest == NetTestType.SuccessfullyPings && packet_type == PacketType.ping_answer && sHost == nt.sHost && dHost == null && dIP != null && dIP.BroadcastAddress == dIP.GetIP && dIP.GetIPString == nt.dHost)
 | 
			
		||||
                    nt.SetDone(PacketID);
 | 
			
		||||
                if (nt.TheTest == NetTestType.SuccessfullyPingsWithoutLoop && !HadLoop && packet_type == PacketType.ping_answer && sHost == nt.sHost && dHost == nt.dHost)
 | 
			
		||||
                    nt.SetDone(PacketID);
 | 
			
		||||
                if (nt.TheTest == NetTestType.SuccessfullyPingsWithoutLoop && !HadLoop && packet_type == PacketType.ping_answer && sHost == nt.sHost && dHost == null && dIP != null && dIP.BroadcastAddress == dIP.GetIP && dIP.GetIPString == nt.dHost)
 | 
			
		||||
                    nt.SetDone(PacketID);
 | 
			
		||||
                if (nt.TheTest == NetTestType.SuccessfullyTraceroutes && packet_type == PacketType.tracert_reply && sHost == nt.sHost && dHost == nt.dHost)
 | 
			
		||||
                    nt.SetDone(PacketID);
 | 
			
		||||
                if (nt.TheTest == NetTestType.SuccessfullyTraceroutes && packet_type == PacketType.tracert_reply && sHost == nt.sHost && dHost == null && dIP != null && dIP.BroadcastAddress == dIP.GetIP && dIP.GetIPString == nt.dHost)
 | 
			
		||||
@@ -1348,6 +1355,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public bool HasCompletedPingTest(PacketType packet_type, NetworkDevice source, NB_IPAddress sIP, NB_IPAddress dIP, int PacketID)
 | 
			
		||||
        {
 | 
			
		||||
            if (packet_type != PacketType.ping_answer) return false; //This only works with pings.
 | 
			
		||||
@@ -1628,6 +1636,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
                    AlreadyChosenTimeout = false; //we do this at the beginning of processing
 | 
			
		||||
                    NumberOfSecondsForTimeout = DefaultTimeout;
 | 
			
		||||
                    NetworkStartTime = DateTime.Now;
 | 
			
		||||
                    ClearPacketCounters();
 | 
			
		||||
                }
 | 
			
		||||
                ProcessPacketsOnce();
 | 
			
		||||
                if(!ProcessingShouldContinue())
 | 
			
		||||
@@ -1674,6 +1683,7 @@ namespace EduNetworkBuilder
 | 
			
		||||
                    NB.SetProgress(0, NumberOfSecondsForTimeout);
 | 
			
		||||
                    NB.UpdateMessages();
 | 
			
		||||
                    NB.MarkToUpdate();
 | 
			
		||||
                    ClearPacketCounters();
 | 
			
		||||
                }
 | 
			
		||||
                previously_had_packets = false;
 | 
			
		||||
            }
 | 
			
		||||
@@ -1687,6 +1697,19 @@ namespace EduNetworkBuilder
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void ClearPacketCounters()
 | 
			
		||||
        {
 | 
			
		||||
            HadLoop = false;
 | 
			
		||||
            foreach(NetworkComponent NC in NetComponents)
 | 
			
		||||
            {
 | 
			
		||||
                if(NC is NetworkDevice)
 | 
			
		||||
                {
 | 
			
		||||
                    NetworkDevice ND = (NetworkDevice)NC;
 | 
			
		||||
                    ND.PacketIDsPassedThrough.Clear();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void AddAnimation(AnimationName What, Rectangle Where)
 | 
			
		||||
        {
 | 
			
		||||
            Animations.Add(new AnimationClass(What, Where));
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user