private static void CheckUp() { int natCleanUpDelay = 60; while (Status.State == State.Running) { if (natCleanUpDelay < 1) { RoutingTable.CleanUp(); natCleanUpDelay = 60; } if (physicalWorkers.Any(i => !i.ThreadActive.IsSet) || !tapWorker.ThreadActive.IsSet) { Stop(); break; } double lowestTrafficRate = -1; int currentRoutingInterface = 0; for (int i = 0; i < physicalWorkers.Count; i++) { double currentTrafficRate = Global.NetworkInterfaces[physicalWorkers[i].Guid].IPv4InSpeedAvg10 + Global.NetworkInterfaces[physicalWorkers[i].Guid].IPv4OutSpeedAvg10; if (currentTrafficRate < lowestTrafficRate || lowestTrafficRate == -1) { lowestTrafficRate = currentTrafficRate; currentRoutingInterface = i; } } routingInterface = currentRoutingInterface; natCleanUpDelay--; Thread.Sleep(1000); } }