Merge pull request #2 from Ragora/master

Fixed T2 crash when running in Listen mode
This commit is contained in:
thyth 2017-09-25 22:59:32 -07:00 committed by GitHub
commit 29eb0c7376
2 changed files with 13 additions and 1 deletions

View file

@ -290,6 +290,12 @@ function t2csri_processDownloadCompletion()
function t2csri_gameServerHexAddress()
{
%ip = ServerConnection.getAddress();
// DarkDragonDX: Fix listen server crashes because .getAddress() returns
// "local" when in listen
if (trim(%ip) $= "local")
%ip = "IP:127.0.0.1:" @ $Host::Port; // Build the local IP ourselves
%ip = getSubStr(%ip, strstr(%ip, ":") + 1, strlen(%ip));
%ip = getSubStr(%ip, 0, strstr(%ip, ":"));
%ip = strReplace(%ip, ".", " ");

View file

@ -56,6 +56,12 @@ function serverCmdt2csri_sendCertChunk(%client, %chunk)
function t2csri_gameClientHexAddress(%client)
{
%ip = %client.getAddress();
// DarkDragonDX: Fix listen server crashes because .getAddress() returns
// "local" when in listen
if (trim(%ip) $= "local")
%ip = "IP:127.0.0.1:" @ $Host::Port; // Just build the local IP
%ip = getSubStr(%ip, strstr(%ip, ":") + 1, strlen(%ip));
%ip = getSubStr(%ip, 0, strstr(%ip, ":"));
%ip = strReplace(%ip, ".", " ");
@ -291,7 +297,7 @@ package t2csri_server
// clan support will be implemented via delegation to a community server
function GameConnection::getAuthInfo(%client)
{
if (%client.getAddress() $= "Local" && %client.t2csri_authInfo $= "")
if (trim(%client.getAddress()) $= "local" && %client.t2csri_authInfo $= "")
%client.t2csri_authInfo = WONGetAuthInfo();
return %client.t2csri_authInfo;
}