Now logs null sockets on unhandled exception in serverloop/listenforclients. Hopefully to track down the null error in terraria.

This commit is contained in:
high 2011-07-24 01:14:50 -04:00
parent d515616f72
commit 1a49d68dc4
2 changed files with 21 additions and 2 deletions

View file

@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.1.3.0723")]
[assembly: AssemblyFileVersion("3.1.3.0723")]
[assembly: AssemblyVersion("3.1.4.0724")]
[assembly: AssemblyFileVersion("3.1.4.0724")]

View file

@ -222,6 +222,25 @@ namespace TShockAPI
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Log.Error(e.ExceptionObject.ToString());
if (e.ExceptionObject.ToString().Contains("Terraria.Netplay.ListenForClients") ||
e.ExceptionObject.ToString().Contains("Terraria.Netplay.ServerLoop"))
{
var sb = new List<string>();
for (int i = 0; i < Netplay.serverSock.Length; i++)
{
if (Netplay.serverSock[i] == null)
{
sb.Add("Sock[" + i + "]");
}
else if (Netplay.serverSock[i].tcpClient == null)
{
sb.Add("Tcp[" + i + "]");
}
}
Log.Error(string.Join(", ", sb));
}
if (e.IsTerminating)
{
if (Main.worldPathName != null)