]> git.meshlink.io Git - catta/blobdiff - avahi-compat-libdns_sd/compat.c
add new utility "avahi-set-host-name" for changing the mDNS host name during runtime
[catta] / avahi-compat-libdns_sd / compat.c
index effa0e7adbdfbd6dd95176c2ac4af9a35049b7ff..e5692bbe7f66db406e3765791398547b7dded42d 100644 (file)
@@ -790,7 +790,8 @@ static void reg_report_error(DNSServiceRef sdref, DNSServiceErrorType error) {
     assert(sdref);
     assert(sdref->n_ref >= 1);
 
-    assert(sdref->service_register_callback);
+    if (!sdref->service_register_callback)
+        return;
 
     regtype = add_trailing_dot(sdref->service_regtype, regtype_fixed, sizeof(regtype_fixed));
     domain = add_trailing_dot(sdref->service_domain, domain_fixed, sizeof(domain_fixed));
@@ -896,6 +897,7 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
         }
             
         case AVAHI_CLIENT_S_COLLISION:
+        case AVAHI_CLIENT_S_REGISTERING:
 
             /* Remove our entry */
             avahi_entry_group_reset(sdref->entry_group);
@@ -903,7 +905,6 @@ static void reg_client_callback(AvahiClient *s, AvahiClientState state, void* us
             break;
 
         case AVAHI_CLIENT_CONNECTING:
-        case AVAHI_CLIENT_S_REGISTERING:
             /* Ignore */
             break;
     }
@@ -983,7 +984,6 @@ DNSServiceErrorType DNSSD_API DNSServiceRegister (
     AVAHI_WARN_LINKAGE;
 
     assert(ret_sdref);
-    assert(callback);
     assert(regtype);
 
     if (interface == kDNSServiceInterfaceIndexLocalOnly || flags) {