catch MappingExceptions in NatDevice.GetExternalIP
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
using System.Net;
|
||||
using Mono.Nat;
|
||||
|
||||
namespace OpenRA.Network
|
||||
@@ -116,5 +116,21 @@ namespace OpenRA.Network
|
||||
Game.Settings.Server.AllowPortForward = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static IPAddress GetExternalIP()
|
||||
{
|
||||
if (NatDevice == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return NatDevice.GetExternalIP();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Write("server", "Failed to get the external IP from NAT device: {0}", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user