2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

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.
This commit is contained in:
diafero
2011-08-03 01:18:08 +02:00
parent 54fcd09692
commit d5885dd677
2 changed files with 58 additions and 7 deletions

View File

@ -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();
}
//============================================================================

View File

@ -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);
}