ares_timeout: missing thread-safety lock

pull/797/head
Brad House 5 months ago
parent ef186fe2a4
commit 74a64e486a
  1. 22
      src/lib/ares_timeout.c

@ -84,8 +84,9 @@ static void struct_timeval_to_ares_timeval(ares_timeval_t *atv, const struct tim
atv->usec = (unsigned int)tv->tv_usec;
}
struct timeval *ares_timeout(const ares_channel_t *channel,
struct timeval *maxtv, struct timeval *tvbuf)
static struct timeval *ares_timeout_int(const ares_channel_t *channel,
struct timeval *maxtv,
struct timeval *tvbuf)
{
const struct query *query;
ares__slist_node_t *node;
@ -130,3 +131,20 @@ struct timeval *ares_timeout(const ares_channel_t *channel,
return tvbuf;
}
struct timeval *ares_timeout(const 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