Browse Source

if no auth server is set, ask the gate keeper about it (does NOT really add a new message, just enables it. DS already supports it in master)

this makes the setup even easier... just one server to be configured in the server.ini.
diafero 13 years ago
parent
commit
d5885dd677
  1. 53
      Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp
  2. 12
      Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

53
Sources/Plasma/PubUtilLib/plNetClientComm/plNetClientComm.cpp

@ -91,8 +91,10 @@ static NetCommAge s_age;
static NetCommAge s_startupAge;
static bool s_needAvatarLoad = true;
static bool s_loginComplete = false;
static bool s_hasAuthSrvIpAddress = false;
static bool s_hasFileSrvIpAddress = false;
static ENetError s_authResult = kNetErrAuthenticationFailed;
static wchar s_authSrvAddr[256];
static wchar s_fileSrvAddr[256];
static wchar s_iniServerAddr[256];
@ -829,6 +831,16 @@ static void IReadNetIni() {
IniClose(ini);
}
//============================================================================
static void AuthSrvIpAddressCallback (
ENetError result,
void * param,
const wchar addr[]
) {
StrCopy(s_authSrvAddr, addr, arrsize(s_authSrvAddr));
s_hasAuthSrvIpAddress = true;
}
//============================================================================
static void FileSrvIpAddressCallback (
ENetError result,
@ -979,21 +991,47 @@ void NetCommConnect () {
const wchar ** addrs;
unsigned count;
count = GetAuthSrvHostnames(&addrs);
NetCliAuthStartConnect(addrs, count);
hsBool connectedToKeeper = false;
// if a console override was specified for a authserv, connect directly to the authserver rather than going through the gatekeeper
if((count = GetAuthSrvHostnames(&addrs)) && wcslen(addrs[0]))
{
NetCliAuthStartConnect(addrs, count);
}
else
{
count = GetGateKeeperSrvHostnames(&addrs);
NetCliGateKeeperStartConnect(addrs, count);
connectedToKeeper = true;
// request an auth server ip address
NetCliGateKeeperAuthSrvIpAddressRequest(AuthSrvIpAddressCallback, nil);
while(!s_hasAuthSrvIpAddress && !s_netError) {
NetClientUpdate();
AsyncSleep(10);
}
const wchar * authSrv[] = {
s_authSrvAddr
};
NetCliAuthStartConnect(authSrv, 1);
}
if (!gDataServerLocal) {
// if a console override was specified for a filesrv, connect directly to the fileserver rather than going through the gatekeeper
if(GetFileSrvHostnames(&addrs) && wcslen(addrs[0]))
if((count = GetFileSrvHostnames(&addrs)) && wcslen(addrs[0]))
{
NetCliFileStartConnect(addrs, count);
}
else
{
count = GetGateKeeperSrvHostnames(&addrs);
NetCliGateKeeperStartConnect(addrs, count);
if (!connectedToKeeper) {
count = GetGateKeeperSrvHostnames(&addrs);
NetCliGateKeeperStartConnect(addrs, count);
connectedToKeeper = true;
}
// request a file server ip address
NetCliGateKeeperFileSrvIpAddressRequest(FileSrvIpAddressCallback, nil, false);
@ -1009,6 +1047,9 @@ void NetCommConnect () {
NetCliFileStartConnect(fileSrv, 1);
}
}
if (connectedToKeeper)
NetCliGateKeeperDisconnect();
}
//============================================================================

12
Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp

@ -735,6 +735,7 @@ static NetMsgInitSend s_send[] = {
static NetMsgInitRecv s_recv[] = {
{ MSG(PingReply) },
{ MSG(FileSrvIpAddressReply) },
{ MSG(AuthSrvIpAddressReply) },
};
#undef MSG
@ -1115,4 +1116,13 @@ void NetCliGateKeeperFileSrvIpAddressRequest (
) {
FileSrvIpAddressRequestTrans * trans = NEW(FileSrvIpAddressRequestTrans)(callback, param, isPatcher);
NetTransSend(trans);
}
}
//============================================================================
void NetCliGateKeeperAuthSrvIpAddressRequest (
FNetCliGateKeeperAuthSrvIpAddressRequestCallback callback,
void * param
) {
AuthSrvIpAddressRequestTrans * trans = NEW(AuthSrvIpAddressRequestTrans)(callback, param);
NetTransSend(trans);
}

Loading…
Cancel
Save