(svn r15163) -Change/Fix: use a non-blocking method to resolve the hostname and connect to game servers.

This commit is contained in:
rubidium
2009-01-20 11:28:18 +00:00
parent 12ff4cf083
commit 206841ba5f
11 changed files with 339 additions and 173 deletions

View File

@@ -0,0 +1,30 @@
/* $Id$ */
/** @file core/address.cpp Implementation of the address. */
#include "../../stdafx.h"
#ifdef ENABLE_NETWORK
#include "address.h"
#include "host.h"
const char *NetworkAddress::GetHostname() const
{
if (this->hostname != NULL) return this->hostname;
in_addr addr;
addr.s_addr = this->ip;
return inet_ntoa(addr);
}
uint32 NetworkAddress::GetIP()
{
if (!this->resolved) {
this->ip = NetworkResolveHost(this->hostname);
this->resolved = true;
}
return this->ip;
}
#endif /* ENABLE_NETWORK */