Cannot connect to powered off APs

This commit is contained in:
Tim Young 2017-03-11 11:07:01 +03:00
parent 4500416364
commit 0b3213bf67
3 changed files with 11 additions and 1 deletions

View File

@ -1350,6 +1350,7 @@ namespace EduNetworkBuilder
if(NB.GetComponentType(nc) == GeneralComponentType.device) if(NB.GetComponentType(nc) == GeneralComponentType.device)
{ {
checking = (NetworkDevice)nc; checking = (NetworkDevice)nc;
if (checking.PowerOff) continue; //we cannot connect to a powered-off device
if (checking == starting) continue; if (checking == starting) continue;
answer = checking.HasWPortSSIDKey(start.SSID, start.EncryptionKey); answer = checking.HasWPortSSIDKey(start.SSID, start.EncryptionKey);
if(answer != null) if(answer != null)

View File

@ -694,6 +694,7 @@ namespace EduNetworkBuilder
if (ItemClickedOn != null) if (ItemClickedOn != null)
{ {
ItemClickedOn.PowerOff = false; ItemClickedOn.PowerOff = false;
UpdateLinks();
UpdateVisuals(); UpdateVisuals();
} }
} }
@ -703,6 +704,7 @@ namespace EduNetworkBuilder
if (ItemClickedOn != null) if (ItemClickedOn != null)
{ {
ItemClickedOn.PowerOff = true; ItemClickedOn.PowerOff = true;
UpdateLinks();
UpdateVisuals(); UpdateVisuals();
} }
} }

View File

@ -806,7 +806,7 @@ namespace EduNetworkBuilder
tryit = true; tryit = true;
if(!tryit) if(!tryit)
{ {
//Check distance //Check distance and power for AP
NetworkComponent nc = myNet.GetComponentFromID(nic.ConnectedLink); NetworkComponent nc = myNet.GetComponentFromID(nic.ConnectedLink);
if(nc != null) if(nc != null)
{ {
@ -814,6 +814,13 @@ namespace EduNetworkBuilder
double distance = nl.LinkDistance(); double distance = nl.LinkDistance();
if (distance > NB.WirelessReconnectDistance) if (distance > NB.WirelessReconnectDistance)
tryit = true; tryit = true;
//Make sure the far end is powered on
HostNicID EndPoint = nl.Dst;
if (nic.myID.HostID == EndPoint.HostID) EndPoint = nl.Src;
NetworkDevice End = myNet.GetDeviceFromID(EndPoint);
if (End != null && End.PowerOff)
tryit = true;
} }
} }
//Tryit tells us if we should try to reconnect. //Tryit tells us if we should try to reconnect.