+ return NULL;
+}
+
+bool discovery_start(meshlink_handle_t *mesh) {
+ logger(mesh, MESHLINK_DEBUG, "discovery_start called\n");
+
+ assert(mesh);
+ assert(!mesh->catta_poll);
+ assert(!mesh->catta_server);
+ assert(!mesh->catta_browser);
+ assert(!mesh->discovery_threadstarted);
+ assert(!mesh->catta_servicetype);
+
+ assert(pthread_mutex_lock(&mesh->discovery_mutex) == 0);
+
+ // Start the discovery thread
+ if(pthread_create(&mesh->discovery_thread, NULL, discovery_loop, mesh) != 0) {
+ assert(pthread_mutex_unlock(&mesh->discovery_mutex) == 0);
+ logger(mesh, MESHLINK_ERROR, "Could not start discovery thread: %s\n", strerror(errno));
+ memset(&mesh->discovery_thread, 0, sizeof(mesh)->discovery_thread);
+ return false;
+ }
+
+ assert(pthread_cond_wait(&mesh->discovery_cond, &mesh->discovery_mutex) == 0);
+ assert(pthread_mutex_unlock(&mesh->discovery_mutex) == 0);
+
+ mesh->discovery_threadstarted = true;
+
+ return true;