mirror of
https://github.com/netchx/netch.git
synced 2026-03-18 18:13:21 +08:00
CreateUnicastIP timeout
Assign Unicast IP Status Text
This commit is contained in:
@@ -91,6 +91,7 @@ public class TUNController : Guard, IModeController
|
||||
var tunIndex = _tunNetworkInterface.GetIndex();
|
||||
_tun = NetRoute.TemplateBuilder(_tunConfig.Gateway, tunIndex);
|
||||
|
||||
Global.MainForm.StatusText(i18N.Translate("Assign Unicast IP"));
|
||||
if (!RouteHelper.CreateUnicastIP(AddressFamily.InterNetwork,
|
||||
_tunConfig.Address,
|
||||
(byte)Utils.Utils.SubnetToCidr(_tunConfig.Netmask),
|
||||
|
||||
@@ -49,11 +49,10 @@ public static unsafe class RouteHelper
|
||||
{
|
||||
if (type != MIB_NOTIFICATION_TYPE.MibInitialNotification)
|
||||
{
|
||||
// TODO pass error
|
||||
NTSTATUS state;
|
||||
if ((state = GetUnicastIpAddressEntry(row)) != 0)
|
||||
{
|
||||
Log.Error("CreateUnicastIpAddressEntry failed: {0}", state);
|
||||
Log.Error("GetUnicastIpAddressEntry failed: {State}", state.Value);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,11 +78,16 @@ public static unsafe class RouteHelper
|
||||
NTSTATUS state;
|
||||
if ((state = CreateUnicastIpAddressEntry(&addr)) != 0)
|
||||
{
|
||||
Log.Error("CreateUnicastIpAddressEntry failed: {0}", state);
|
||||
Log.Error("CreateUnicastIpAddressEntry failed: {State}", state.Value);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!obj.WaitOne(TimeSpan.FromSeconds(10)))
|
||||
{
|
||||
Log.Error("Wait unicast IP usable timeout");
|
||||
return false;
|
||||
}
|
||||
|
||||
obj.WaitOne();
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user