git-svn-id: svn://ultimatepp.org/upp/trunk@407 f0d560ea-af0d-0410-9eb7-867de7ffcac7

This commit is contained in:
cxl 2008-09-08 09:04:16 +00:00
parent ac7787c74c
commit 3519eb154f

View file

@ -161,6 +161,12 @@ bool Socket::Data::OpenServer(int port, bool nodelay, int listen_count, bool blo
return true;
}
Mutex& GetHostByNameMutex()
{
static StaticCriticalSection m;
return m;
}
bool Socket::Data::OpenClient(const char *host, int port, bool nodelay, dword *my_addr, int timeout, bool block)
{
SLOG("Socket::Data::OpenClient(" << host << ':' << port << ", timeout " << timeout << ", block " << block << ')');
@ -171,7 +177,7 @@ bool Socket::Data::OpenClient(const char *host, int port, bool nodelay, dword *m
sockaddr_in addr;
{
CriticalSection::Lock __(host_lock);
CriticalSection::Lock __(GetHostByNameMutex());
Socket::Init();
hostent *he = gethostbyname(host);
if(!he) {