Cache the IP so that things don't shit bricks when Mono closes the socket.

This commit is contained in:
Deathmax 2011-12-18 07:28:52 +08:00
parent 045eddfcdc
commit d1320e434c
2 changed files with 7 additions and 3 deletions

View file

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

View file

@ -62,6 +62,7 @@ namespace TShockAPI
public bool ForceSpawn = false;
public string Country = "??";
public int Difficulty;
private string CacheIP;
public bool RealPlayer
{
@ -75,7 +76,10 @@ namespace TShockAPI
{
get
{
return RealPlayer ? (Netplay.serverSock[Index].tcpClient.Connected ? TShock.Utils.GetRealIP(Netplay.serverSock[Index].tcpClient.Client.RemoteEndPoint.ToString()) : "") : "";
if (string.IsNullOrEmpty(CacheIP))
return CacheIP = RealPlayer ? (Netplay.serverSock[Index].tcpClient.Connected ? TShock.Utils.GetRealIP(Netplay.serverSock[Index].tcpClient.Client.RemoteEndPoint.ToString()) : "") : "";
else
return CacheIP;
}
}
/// <summary>