Skip to content

Commit

Permalink
Re-advertise when instances are added or updated
Browse files Browse the repository at this point in the history
Also fix memory leak on update
  • Loading branch information
rojer committed Dec 30, 2019
1 parent 2a49fa0 commit 95ca603
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/mgos_dns_sd.c
Expand Up @@ -433,6 +433,7 @@ bool mgos_dns_sd_add_service_instance(
p += len + 1;
}
const struct mg_str txt = MG_MK_STR_N(buf, p - buf);
mg_strfree(&e->txt);
e->txt = mg_strdup(txt);
res = (e->txt.len == txt.len);

Expand All @@ -444,6 +445,9 @@ bool mgos_dns_sd_add_service_instance(
mgos_dns_sd_service_entry_free(e);
}
}
if (res) {
mgos_dns_sd_advertise();
}
return res;
}

Expand Down

0 comments on commit 95ca603

Please sign in to comment.