Commit 356f1f51 authored by Alexander Alashkin's avatar Alexander Alashkin Committed by rojer

Fix connection reuse in mg_if_recv_udp_cb

PUBLISHED_FROM=5d248fd465ade7f42293611bc2d60ed72439a489
parent 06659844
...@@ -2684,19 +2684,20 @@ void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len, ...@@ -2684,19 +2684,20 @@ void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len,
struct mg_add_sock_opts opts; struct mg_add_sock_opts opts;
memset(&opts, 0, sizeof(opts)); memset(&opts, 0, sizeof(opts));
nc = mg_create_connection(lc->mgr, lc->handler, opts); nc = mg_create_connection(lc->mgr, lc->handler, opts);
} if (nc != NULL) {
if (nc != NULL) { nc->sock = lc->sock;
nc->sock = lc->sock; nc->listener = lc;
nc->listener = lc; nc->sa = *sa;
nc->sa = *sa; nc->proto_handler = lc->proto_handler;
nc->proto_handler = lc->proto_handler; nc->user_data = lc->user_data;
nc->user_data = lc->user_data; nc->recv_mbuf_limit = lc->recv_mbuf_limit;
nc->recv_mbuf_limit = lc->recv_mbuf_limit; nc->flags = MG_F_UDP;
nc->flags = MG_F_UDP; mg_add_conn(lc->mgr, nc);
mg_add_conn(lc->mgr, nc); mg_call(nc, NULL, MG_EV_ACCEPT, &nc->sa);
mg_call(nc, NULL, MG_EV_ACCEPT, &nc->sa); } else {
} else { DBG(("OOM"));
DBG(("OOM")); /* No return here, we still need to drop on the floor */
}
} }
} }
if (nc != NULL) { if (nc != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment