+ assert(mesh->avahi_servicetype == NULL);
+
+ // create service type string
+ size_t servicetype_strlen = sizeof(MESHLINK_MDNS_SERVICE_TYPE) + strlen(mesh->appname) + 1;
+ mesh->avahi_servicetype = malloc(servicetype_strlen);
+
+ if(mesh->avahi_servicetype == NULL)
+ {
+ fprintf(stderr, "Failed to allocate memory for service type string.\n");
+ goto fail;
+ }
+
+ snprintf(mesh->avahi_servicetype, servicetype_strlen, MESHLINK_MDNS_SERVICE_TYPE, mesh->appname);