X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fadns.c;fp=src%2Fadns.c;h=08fd8123754aa720c07b2e467815f0a41a422e81;hb=6558e508cc80ec97ec9c5bbcf7df922e13ed5b2e;hp=cb9611e1594b246ab71f8364ef624d33d2ddf3b4;hpb=8e4f6238558c28cd05bd580cc947d7178d2bac90;p=meshlink diff --git a/src/adns.c b/src/adns.c index cb9611e1..08fd8123 100644 --- a/src/adns.c +++ b/src/adns.c @@ -107,7 +107,7 @@ void exit_adns(meshlink_handle_t *mesh) { abort(); } - pthread_cond_signal(&mesh->adns_cond); + assert(pthread_cond_signal(&mesh->adns_cond) == 0); pthread_join(mesh->adns_thread, NULL); meshlink_queue_exit(&mesh->adns_queue); @@ -128,7 +128,7 @@ void adns_queue(meshlink_handle_t *mesh, char *host, char *serv, adns_cb_t cb, v abort(); } - pthread_cond_signal(&mesh->adns_cond); + assert(pthread_cond_signal(&mesh->adns_cond) == 0); } struct adns_blocking_info { @@ -157,16 +157,16 @@ static void *adns_blocking_handler(void *data) { info->ai = NULL; } - pthread_mutex_lock(&info->mutex); + assert(pthread_mutex_lock(&info->mutex) == 0); bool cleanup = info->done; if(!info->done) { info->done = true; - pthread_cond_signal(&info->cond); + assert(pthread_cond_signal(&info->cond) == 0); } - pthread_mutex_unlock(&info->mutex); + assert(pthread_mutex_unlock(&info->mutex) == 0); if(cleanup) { free(info->host); @@ -184,8 +184,8 @@ struct addrinfo *adns_blocking_request(meshlink_handle_t *mesh, char *host, char info->host = host; info->serv = serv; info->socktype = socktype; - pthread_mutex_init(&info->mutex, NULL); - pthread_cond_init(&info->cond, NULL); + assert(pthread_mutex_init(&info->mutex, NULL) == 0); + assert(pthread_cond_init(&info->cond, NULL) == 0); struct timespec deadline; clock_gettime(CLOCK_REALTIME, &deadline); @@ -199,11 +199,11 @@ struct addrinfo *adns_blocking_request(meshlink_handle_t *mesh, char *host, char free(info); return NULL; } else { - pthread_detach(thread); + assert(pthread_detach(thread) == 0); } - pthread_mutex_lock(&info->mutex); - pthread_cond_timedwait(&info->cond, &info->mutex, &deadline); + assert(pthread_mutex_lock(&info->mutex) == 0); + assert(pthread_cond_timedwait(&info->cond, &info->mutex, &deadline) == 0); struct addrinfo *result = NULL; bool cleanup = info->done; @@ -215,7 +215,7 @@ struct addrinfo *adns_blocking_request(meshlink_handle_t *mesh, char *host, char info->done = true; } - pthread_mutex_unlock(&info->mutex); + assert(pthread_mutex_unlock(&info->mutex) == 0); if(cleanup) { free(info->host);