Cleaned up the code for converting between hostnames and IP addresses

a little bit.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402641
This commit is contained in:
Davis King 2008-11-07 02:21:23 +00:00
parent 573d043e8d
commit c379e0cc48
2 changed files with 8 additions and 8 deletions

View File

@ -136,6 +136,8 @@ namespace dlib
try
{
// lock this mutex since gethostbyname isn't really thread safe
auto_mutex M(sockets_kernel_1_mutex::startup_lock);
// if no hostname was given then return error
if ( hostname.empty())
@ -193,6 +195,8 @@ namespace dlib
try
{
// lock this mutex since gethostbyaddr isn't really thread safe
auto_mutex M(sockets_kernel_1_mutex::startup_lock);
// if no ip was given then return error
if (ip.empty())

View File

@ -197,12 +197,10 @@ namespace dlib
int n
)
{
// ensure that WSAStartup has been called and WSACleanup will eventually
// be called when program ends
sockets_startup();
try
{
// lock this mutex since gethostbyname isn't really thread safe
auto_mutex M(sockets_kernel_2_mutex::startup_lock);
// if no hostname was given then return error
if ( hostname.empty())
@ -254,12 +252,10 @@ namespace dlib
std::string& hostname
)
{
// ensure that WSAStartup has been called and WSACleanup will eventually
// be called when program ends
sockets_startup();
try
{
// lock this mutex since gethostbyaddr isn't really thread safe
auto_mutex M(sockets_kernel_2_mutex::startup_lock);
// if no ip was given then return error
if (ip.empty())