Check listener when reusing UDP conn. Closes cesanta/dev#3139

PUBLISHED_FROM=f03f8fad30faee62f290d37b0b909ef49f301b80
This commit is contained in:
Alexander Alashkin 2016-04-01 16:03:54 +01:00 committed by rojer
parent fe0d340c03
commit 55c2634416

View File

@ -2698,7 +2698,9 @@ void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len,
* This is very inefficient for long connection lists.
*/
for (nc = mg_next(lc->mgr, NULL); nc != NULL; nc = mg_next(lc->mgr, nc)) {
if (memcmp(&nc->sa.sa, &sa->sa, sa_len) == 0) break;
if (memcmp(&nc->sa.sa, &sa->sa, sa_len) == 0 && nc->listener == lc) {
break;
}
}
if (nc == NULL) {
struct mg_add_sock_opts opts;