Fixes exiting/crash handling/ctrl+c (#237)

- [X] Fixes handling of CTRL+C
- [X] Fixes crash guard (but should really be rewritten
- [X] Fixes exiting/restarting

Bumps release version
This commit is contained in:
Kamron Batman 2020-09-12 00:05:38 -07:00 • committed by GitHub
parent 76a9729f61
commit 55ae0f8778
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 216 additions and 160 deletions

View file

@ -54,15 +54,21 @@ namespace Server.Network
public static IPAddress[] GetListeningAddresses(IPEndPoint ipep)
{
if (m_ListeningAddresses != null)
{
return m_ListeningAddresses;
}
var list = new List<IPAddress>();
foreach (var adapter in NetworkInterface.GetAllNetworkInterfaces())
{
var properties = adapter.GetIPProperties();
foreach (var unicast in properties.UnicastAddresses)
{
if (ipep.AddressFamily == unicast.Address.AddressFamily)
{
list.Add(unicast.Address);
}
}
}
return list.ToArray();
@ -71,10 +77,16 @@ namespace Server.Network
private static void DisplayListener(IPEndPoint ipep)
{
if (ipep.Address.Equals(IPAddress.Any) || ipep.Address.Equals(IPAddress.IPv6Any))
{
foreach (var ip in m_ListeningAddresses)
{
Console.WriteLine("Listening: {0}:{1}", ip, ipep.Port);
}
}
else
{
Console.WriteLine("Listening: {0}:{1}", ipep.Address, ipep.Port);
}
}
}
}