From 25d42ad345d9fbc25423e332df7af430b27bdf1c Mon Sep 17 00:00:00 2001 From: Andrew Griffiths Date: Sat, 24 Sep 2022 14:14:26 +1000 Subject: [PATCH] Fix SSDP example for second and subsequent responses --- examples/udp-ssdp-search/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/udp-ssdp-search/main.c b/examples/udp-ssdp-search/main.c index dc8f8cae..407e0b0e 100644 --- a/examples/udp-ssdp-search/main.c +++ b/examples/udp-ssdp-search/main.c @@ -33,6 +33,9 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { // But in our case, we should restore the multicast address in order // to have next search to go to the multicast address memcpy(&c->rem, c->label, sizeof(c->rem)); + // Discard the content of this response as we expect each SSDP response + // to generate at most one MG_EV_READ event. + c->recv.len = 0UL; } }