ares_timeout: missing thread-safety lock

v1.28
Brad House 8 months ago
parent b261b17930
commit 1f37dbaf04
  1. 22
      src/lib/ares_timeout.c

@ -55,8 +55,9 @@ void ares__timeval_remaining(struct timeval *remaining,
}
}
struct timeval *ares_timeout(ares_channel_t *channel, struct timeval *maxtv,
struct timeval *tvbuf)
static struct timeval *ares_timeout_int(ares_channel_t *channel,
struct timeval *maxtv,
struct timeval *tvbuf)
{
const struct query *query;
ares__slist_node_t *node;
@ -95,3 +96,20 @@ struct timeval *ares_timeout(ares_channel_t *channel, struct timeval *maxtv,
return tvbuf;
}
struct timeval *ares_timeout(ares_channel_t *channel,
struct timeval *maxtv, struct timeval *tvbuf)
{
struct timeval *rv;
if (channel == NULL || tvbuf == NULL)
return NULL;
ares__channel_lock(channel);
rv = ares_timeout_int(channel, maxtv, tvbuf);
ares__channel_unlock(channel);
return rv;
}

Loading…
Cancel
Save