pike.git / src / modules / _Protocols_DNS_SD / sd.c

version» Context lines:

pike.git/src/modules/_Protocols_DNS_SD/sd.c:157:    if (err == kDNSServiceErr_NoError)    svc->service_ref = ref;       err = DNSServiceProcessResult(ref);    return err;   }         static void stop_service(struct service *svc)   { -  if (svc->service_ref) { +  if (svc->service_ref)    DNSServiceRefDeallocate(svc->service_ref); -  svc->service_ref = NULL; +    } - } +          static DNSServiceErrorType update_txt_record(struct service *svc,    char *txt, int txtlen)   {    if (svc->service_ref) {    int ttl = 0;    return DNSServiceUpdateRecord(svc->service_ref, NULL, 0,    txtlen, txt, ttl);    }
pike.git/src/modules/_Protocols_DNS_SD/sd.c:362:    txt = (args == 5) ? sp[4 - args].u.string->str : NULL;    txtlen = txt ? sp[4 - args].u.string->len : 0;       /* Register new service */    err = start_service(THIS, name, service, domain, port, txt, txtlen);    if (IS_ERR(err))    raise_error("Could not register service.", err);   }       - static void init_service_struct(struct object *UNUSED(o)) - { -  THIS->service_ref = 0; - } -  -  +    static void exit_service_struct(struct object *UNUSED(o))   {    /* Stop an existing service */    stop_service(THIS);   }         PIKE_MODULE_INIT   {    start_new_program();       ADD_STORAGE(struct service);    -  set_init_callback(init_service_struct); +     set_exit_callback(exit_service_struct);       /* function(string, string, string, int, string|void:void) */    ADD_FUNCTION("create", f_create,    tFunc(tStr tStr tStr tInt tOr(tStr, tVoid), tVoid), 0);       /* function(string:void) */    ADD_FUNCTION("update_txt", f_update_txt, tFunc(tStr, tVoid), 0);       end_class("Service", 0);