Fixed glitch with finding best wireless
This commit is contained in:
parent
5df3735d09
commit
322b14a608
@ -177,6 +177,8 @@ namespace EduNetworkBuilder
|
||||
break;
|
||||
}
|
||||
}
|
||||
DoAllVerifyLinks();
|
||||
DoAllAutoJoin();
|
||||
}
|
||||
if (NetMessage.GetText() != "" && !AlreadyDisplayedMessage)
|
||||
{
|
||||
@ -1134,7 +1136,7 @@ namespace EduNetworkBuilder
|
||||
if(answer != null)
|
||||
{
|
||||
double tdist = distance(starting, checking);
|
||||
if(tdist < l_distance)
|
||||
if(tdist < l_distance && tdist < NB.WirelessMaxUnsuccessfulLink)
|
||||
{
|
||||
l_distance = tdist;
|
||||
found = answer;
|
||||
|
@ -676,7 +676,8 @@ namespace EduNetworkBuilder
|
||||
tryit = false;
|
||||
if (nic.GetNicType != NicType.wlan) continue;
|
||||
if (nic.SSID == "") continue;
|
||||
if (!nic.isConnected(false)) tryit = true;
|
||||
if (!nic.isConnected(false))
|
||||
tryit = true;
|
||||
if(!tryit)
|
||||
{
|
||||
//Check distance
|
||||
@ -692,11 +693,23 @@ namespace EduNetworkBuilder
|
||||
//Tryit tells us if we should try to reconnect.
|
||||
if (tryit)
|
||||
{
|
||||
if(nic.isConnected(false))
|
||||
{
|
||||
//remove old connection
|
||||
NetworkLink oNL = myNet.GetLinkFromID(nic.ConnectedLink);
|
||||
if(oNL != null)
|
||||
{
|
||||
myNet.RemoveComponent(oNL);
|
||||
oNL.Destroy();
|
||||
}
|
||||
}
|
||||
//We want to find the closest device with an open wport that matches ssid/key and connect to it.
|
||||
NetworkCard Closest = myNet.BestWirelessLinkForDevice(nic);
|
||||
if(Closest != null)
|
||||
{
|
||||
NetworkLink newLink = new NetworkLink(nic.myID, Closest.myID, LinkType.wireless);
|
||||
nic.ConnectedLink = newLink.GetUniqueIdentifier;
|
||||
Closest.ConnectedLink = newLink.GetUniqueIdentifier;
|
||||
myNet.AddItem(newLink);
|
||||
didsomething = true;
|
||||
}
|
||||
|
@ -123,7 +123,6 @@ namespace EduNetworkBuilder
|
||||
writer.WriteElementString("linktype", theLinkType.ToString());
|
||||
writer.WriteElementString("uniqueidentifier", UniqueIdentifier.ToString());
|
||||
writer.WriteEndElement();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user