mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
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:
parent
573d043e8d
commit
c379e0cc48
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user