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