X-Git-Url: http://git.meshlink.io/?p=meshlink;a=blobdiff_plain;f=src%2Fdiscovery.c;h=481b2f2872f22675d909924fea9b61d89f342189;hp=9064523c9c603222cd2e55bd8736a56c1f712ec5;hb=93a7614d2aa368a9799d6e39c73542a3998e70bf;hpb=29c29069e5637613b4f65e92825a78d658b491df diff --git a/src/discovery.c b/src/discovery.c index 9064523c..481b2f28 100644 --- a/src/discovery.c +++ b/src/discovery.c @@ -341,6 +341,7 @@ static void discovery_log_cb(CattaLogLevel level, const char *txt) { } static void *discovery_loop(void *userdata) { + bool status = false; meshlink_handle_t *mesh = userdata; assert(mesh != NULL); @@ -397,13 +398,17 @@ static void *discovery_loop(void *userdata) { goto fail; } + status = true; + +fail: + pthread_mutex_lock(&mesh->discovery_mutex); pthread_cond_broadcast(&mesh->discovery_cond); pthread_mutex_unlock(&mesh->discovery_mutex); - catta_simple_poll_loop(mesh->catta_poll); - -fail: + if(status) { + catta_simple_poll_loop(mesh->catta_poll); + } if(mesh->catta_browser != NULL) { catta_s_service_browser_free(mesh->catta_browser);