Add response to service meta-query (RFC6763 Section 10), following https://github.com/espressif/esp-idf/pull/340/files
This commit is contained in:
parent
3c1f038fbc
commit
17ef47d6f2
15
mdnsd.c
15
mdnsd.c
@ -630,8 +630,19 @@ static int populate_probe(struct mdnsd *svr, struct rr_list **rr_head)
|
||||
static int populate_answers(struct mdnsd *svr, struct rr_list **rr_head, uint8_t *name, enum rr_type type) {
|
||||
int num_ans = 0;
|
||||
|
||||
// check if we have the records
|
||||
pthread_mutex_lock(&svr->data_lock);
|
||||
|
||||
if (type == RR_PTR && 0 == cmp_nlabel(SERVICES_DNS_SD_NLABEL, name)) {
|
||||
|
||||
// add answers for all services
|
||||
for (struct rr_list *n = svr->services; n; n = n->next) {
|
||||
// if (s->service->service && s->service->proto)
|
||||
num_ans += rr_list_append(rr_head, n->e);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// check if we have the records
|
||||
struct rr_group *ans_grp = rr_group_find(svr->group, name);
|
||||
if (ans_grp != NULL) {
|
||||
// decide which records should go into answers
|
||||
@ -646,6 +657,7 @@ static int populate_answers(struct mdnsd *svr, struct rr_list **rr_head, uint8_t
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
pthread_mutex_unlock(&svr->data_lock);
|
||||
|
||||
return num_ans;
|
||||
@ -2341,7 +2353,6 @@ int mdnsd_discover_service(char *service_type, int discover_time_msec, struct md
|
||||
{
|
||||
int result = -1;
|
||||
struct timeval old_time, cur_time;
|
||||
unsigned int time_diff;
|
||||
int try_count;
|
||||
int domain;
|
||||
char service_type_str[128];
|
||||
|
Loading…
Reference in New Issue
Block a user