One item to break
This commit is contained in:
parent
75bcd6d0ba
commit
eddfb773c0
@ -1909,9 +1909,9 @@ namespace EduNetworkBuilder
|
||||
}
|
||||
}
|
||||
|
||||
bool BreakNetComponent(NetworkComponent What, HowToBreak How)
|
||||
int BreakNetComponent(NetworkComponent What, HowToBreak How)
|
||||
{
|
||||
bool didit = false;
|
||||
int didit = 0;
|
||||
NetworkDevice tDevice = null;
|
||||
NetworkLink tLink = null;
|
||||
if (What is NetworkDevice) tDevice = (NetworkDevice)What;
|
||||
@ -1920,7 +1920,7 @@ namespace EduNetworkBuilder
|
||||
{
|
||||
case HowToBreak.PowerOff:
|
||||
tDevice.PowerOff = true;
|
||||
didit = true;
|
||||
didit = 1;
|
||||
break;
|
||||
case HowToBreak.DeviceChangeGW:
|
||||
break;
|
||||
@ -1928,7 +1928,7 @@ namespace EduNetworkBuilder
|
||||
break;
|
||||
case HowToBreak.EthernetBreak:
|
||||
tLink.theLinkType = LinkType.broken;
|
||||
didit = true;
|
||||
didit = 1;
|
||||
break;
|
||||
case HowToBreak.EthernetCorrupt:
|
||||
break;
|
||||
@ -1953,17 +1953,31 @@ namespace EduNetworkBuilder
|
||||
return didit;
|
||||
}
|
||||
|
||||
bool BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
|
||||
int BreakNetworkPath(TraversalClass ThePath, HowToBreak How)
|
||||
{
|
||||
//find the device name it belongs to
|
||||
//try to break it. If it fails, try a different device.
|
||||
//Fail if we cannot do it
|
||||
TraversalTechnology WhatNeeded = NB.TechnologyNeededToBreak(How);
|
||||
|
||||
int count = 0;
|
||||
while(count < 3)
|
||||
{
|
||||
string host = ThePath.HostnameFromTechnology();
|
||||
string host = ThePath.HostnameFromTechnology(WhatNeeded);
|
||||
if(host != "")
|
||||
{
|
||||
//We have a host, see if we can break it.
|
||||
NetworkComponent NC = ItemFromName(host);
|
||||
if(NC != null)
|
||||
{
|
||||
int answer = BreakNetComponent(NC, How);
|
||||
if (answer>0) return answer;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user