]> git.meshlink.io Git - meshlink/commitdiff
allow multiple instances of avahi
authorNiklas Hofmann <niklas.hofmann@everbase.net>
Fri, 8 Aug 2014 15:00:32 +0000 (17:00 +0200)
committerNiklas Hofmann <niklas.hofmann@everbase.net>
Fri, 8 Aug 2014 15:00:32 +0000 (17:00 +0200)
avahi
examples/manynodes.c
src/meshlink.c

diff --git a/avahi b/avahi
index abf0d60e6dd933273887c1600e0793eac2706438..7a5b2f69af7d36d6cd4153142f125fa011784e03 160000 (submodule)
--- a/avahi
+++ b/avahi
@@ -1 +1 @@
-Subproject commit abf0d60e6dd933273887c1600e0793eac2706438
+Subproject commit 7a5b2f69af7d36d6cd4153142f125fa011784e03
index 991d5ba65868622a36b68900f15c0bb20f1d74fb..3df6cadb8ede1980fc3ebabc88a56a89adea7d95 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "../src/meshlink.h"
 
-static int n = 100;
+static int n = 10;
 static meshlink_handle_t **mesh;
 
 static meshlink_node_t **nodes;
index 601f49da910e61eebe941ef7646bb479d60fb1cd..79db920b6a9d39eef024f6ee56c692679024925b 100644 (file)
@@ -48,7 +48,6 @@ typedef struct {
 #endif
 
 static pthread_mutex_t global_mutex;
-static bool discovery_started;
 
 __thread meshlink_errno_t meshlink_errno;
 
@@ -874,17 +873,7 @@ bool meshlink_start(meshlink_handle_t *mesh) {
 
        mesh->threadstarted=true;
 
-       // Start discovery
-       // Since only one Avahi instance can run in one program at the moment, make sure we only start one, ignore it otherwise.
-
-       bool discovery_on = false;
-       pthread_mutex_lock(&global_mutex);
-       if(!discovery_started)
-               discovery_on = discovery_started = true;
-       pthread_mutex_unlock(&global_mutex);
-
-       if(discovery_on)
-               discovery_start(mesh);
+       discovery_start(mesh);
 
        return true;
 }
@@ -899,14 +888,7 @@ void meshlink_stop(meshlink_handle_t *mesh) {
        }
 
        // Stop discovery
-
-       bool discovery_on = mesh->discovery_threadstarted;
        discovery_stop(mesh);
-       if(discovery_on) {
-               pthread_mutex_lock(&global_mutex);
-               discovery_started = false;
-               pthread_mutex_unlock(&global_mutex);
-       }
 
        // Shut down a listening socket to signal the main thread to shut down