Skip to content

Commit

Permalink
Fix compilation (#3522)
Browse files Browse the repository at this point in the history
  • Loading branch information
twose authored Jul 31, 2020
1 parent 20b4dd2 commit 85bb2a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/network/dns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,6 @@ static void domain_decode(char *str) {
namespace swoole {
namespace network {

#ifndef HAVE_GETHOSTBYNAME2_R
static std::mutex g_gethostbyname2_lock;
#endif

/**
* DNS lookup
*/
Expand Down
6 changes: 4 additions & 2 deletions src/os/base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,16 @@ void handler_gethostbyname(Event *event) {
int ret;

#ifndef HAVE_GETHOSTBYNAME2_R
g_gethostbyname2_lock.lock();
static std::mutex lock;
lock.lock();
#endif

ret = swoole::network::gethostbyname(event->flags, (char *) event->buf, addr);

sw_memset_zero(event->buf, event->nbytes);

#ifndef HAVE_GETHOSTBYNAME2_R
g_gethostbyname2_lock.unlock();
lock.unlock();
#endif

if (ret < 0) {
Expand Down

0 comments on commit 85bb2a3

Please sign in to comment.