Commit c379e0cc authored by Davis King's avatar Davis King

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
parent 573d043e
......@@ -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())
......
......@@ -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())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment