Cache the IP so that things don't shit bricks when Mono closes the socket.
This commit is contained in:
parent
045eddfcdc
commit
d1320e434c
2 changed files with 7 additions and 3 deletions
|
|
@ -36,5 +36,5 @@ using System.Runtime.InteropServices;
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
|
||||||
[assembly: AssemblyVersion("3.3.4.1217")]
|
[assembly: AssemblyVersion("3.3.4.1218")]
|
||||||
[assembly: AssemblyFileVersion("3.3.4.1217")]
|
[assembly: AssemblyFileVersion("3.3.4.1218")]
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ namespace TShockAPI
|
||||||
public bool ForceSpawn = false;
|
public bool ForceSpawn = false;
|
||||||
public string Country = "??";
|
public string Country = "??";
|
||||||
public int Difficulty;
|
public int Difficulty;
|
||||||
|
private string CacheIP;
|
||||||
|
|
||||||
public bool RealPlayer
|
public bool RealPlayer
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +76,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
get
|
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>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue