Skip to content

Commit

Permalink
Remove all local IP addresses, not just the first
Browse files Browse the repository at this point in the history
  • Loading branch information
nwoolls committed Aug 25, 2014
1 parent 40b5a20 commit 0503984
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MultiMiner.Utility/Net/PortScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static List<IPEndPoint> Find(string ipRange, int startingPort, int ending
List<IPAddress> ipAddresses = new IPRange(ipRange).GetIPAddresses().ToList();

//optimize until we need otherwise
ipAddresses.RemoveAll(ip => ip.ToString().Equals(LocalNetwork.GetLocalIPAddress()));
ipAddresses.RemoveAll(ip => LocalNetwork.GetLocalIPAddresses().Contains(ip.Address.ToString()));
ipAddresses.RemoveAll(ip => ip.ToString().EndsWith(".0"));

foreach (IPAddress ipAddress in ipAddresses)
Expand Down
8 changes: 4 additions & 4 deletions MultiMiner.Win/Forms/MinerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ private void FindNetworkDevices()
List<IPEndPoint> miners = MinerFinder.Find(localIpRange, startingPort, endingPort);

//remove own miners
miners.RemoveAll(m => m.Address.ToString().Equals(Utility.Net.LocalNetwork.GetLocalIPAddress()));
miners.RemoveAll(m => Utility.Net.LocalNetwork.GetLocalIPAddresses().Contains(m.Address.ToString()));

List<NetworkDevices.NetworkDevice> newDevices = miners.ToNetworkDevices();

Expand All @@ -1751,7 +1751,7 @@ private void CheckNetworkDevices()
List<IPEndPoint> endpoints = networkDevicesConfiguration.Devices.ToIPEndPoints();

//remove own miners
endpoints.RemoveAll(m => m.Address.ToString().Equals(Utility.Net.LocalNetwork.GetLocalIPAddress()));
endpoints.RemoveAll(m => Utility.Net.LocalNetwork.GetLocalIPAddresses().Contains(m.Address.ToString()));

endpoints = MinerFinder.Check(endpoints);

Expand Down Expand Up @@ -5144,11 +5144,11 @@ private void RefreshViewFromDeviceStats()

private void RemoveSelfReferencingNetworkDevices()
{
string localIpAddress = Utility.Net.LocalNetwork.GetLocalIPAddress();
List<string> localIpAddresses = Utility.Net.LocalNetwork.GetLocalIPAddresses();
IEnumerable<DeviceViewModel> networkDevices = localViewModel.Devices.Where(d => d.Kind == DeviceKind.NET).ToList();
foreach (DeviceViewModel networkDevice in networkDevices)
{
if (networkDevice.Pool.DomainFromHost().Equals(localIpAddress))
if (localIpAddresses.Contains(networkDevice.Pool.DomainFromHost()))
//actually remove rather than setting Visible = false
//Visible = false items still get fetched with RefreshNetworkDeviceStats()
localViewModel.Devices.Remove(networkDevice);
Expand Down

0 comments on commit 0503984

Please sign in to comment.