assert(mesh->avahi_server != NULL);
assert(mesh->avahi_poll != NULL);
+ pthread_mutex_lock(&(mesh->mesh_mutex));
+
/* Called whenever the entry group state changes */
switch(state)
{
case AVAHI_ENTRY_GROUP_REGISTERING:
;
}
+
+ pthread_mutex_unlock(&(mesh->mesh_mutex));
}
assert(mesh->avahi_servicetype != NULL);
assert(mesh->self != NULL);
+ pthread_mutex_lock(&(mesh->mesh_mutex));
+
logger(mesh, MESHLINK_DEBUG, "Adding service\n");
/* Ifthis is the first time we're called, let's create a new entry group */
done:
if(txt_name)
{ free(txt_name); }
+
+ pthread_mutex_unlock(&(mesh->mesh_mutex));
}
static void discovery_server_callback(AvahiServer *server, AvahiServerState state, void * userdata)
// asserts
assert(mesh != NULL);
+
+ pthread_mutex_lock(&(mesh->mesh_mutex));
switch(state)
{
case AVAHI_SERVER_INVALID:
break;
}
+
+ pthread_mutex_unlock(&(mesh->mesh_mutex));
}
static void discovery_resolve_callback(AvahiSServiceResolver *resolver, AvahiIfIndex interface, AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, const char *domain, const char *host_name, const AvahiAddress *address, uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, void* userdata)
assert(mesh != NULL);
assert(mesh->avahi_server != NULL);
+ pthread_mutex_lock(&(mesh->mesh_mutex));
+
/* Called whenever a service has been resolved successfully or timed out */
switch(event)
{
}
avahi_s_service_resolver_free(resolver);
+
+ pthread_mutex_unlock(&(mesh->mesh_mutex));
}
static void discovery_browse_callback(AvahiSServiceBrowser *browser, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, const char *name, const char *type, const char *domain, AvahiLookupResultFlags flags, void* userdata)
assert(mesh->avahi_server != NULL);
assert(mesh->avahi_poll != NULL);
+ pthread_mutex_lock(&(mesh->mesh_mutex));
+
/* Called whenever a new services becomes available on the LAN or is removed from the LAN */
switch (event)
{
}
break;
}
+
+ pthread_mutex_unlock(&(mesh->mesh_mutex));
}
static void *discovery_loop(void *userdata)