mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-17 19:30:36 +00:00
Minor memory optimization
Release pbuf sooner: after copying data from, before invoking user code PUBLISHED_FROM=b877c96ef602bbca26762b18b9dde17eb880d1f9
This commit is contained in:
1 parent
38efe632ae
commit
49ca223e9c
1 file changed
+3
-3
+3
-3
@@ -13928,15 +13928,15 @@ static void mg_lwip_handle_recv_tcp(struct mg_connection *nc) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
pbuf_copy_partial(seg, data, len, cs->rx_offset);
|
pbuf_copy_partial(seg, data, len, cs->rx_offset);
|
||||||
mgos_unlock();
|
|
||||||
mg_if_recv_tcp_cb(nc, data, len, 1 /* own */);
|
|
||||||
mgos_lock();
|
|
||||||
cs->rx_offset += len;
|
cs->rx_offset += len;
|
||||||
if (cs->rx_offset == cs->rx_chain->len) {
|
if (cs->rx_offset == cs->rx_chain->len) {
|
||||||
cs->rx_chain = pbuf_dechain(cs->rx_chain);
|
cs->rx_chain = pbuf_dechain(cs->rx_chain);
|
||||||
pbuf_free(seg);
|
pbuf_free(seg);
|
||||||
cs->rx_offset = 0;
|
cs->rx_offset = 0;
|
||||||
}
|
}
|
||||||
|
mgos_unlock();
|
||||||
|
mg_if_recv_tcp_cb(nc, data, len, 1 /* own */);
|
||||||
|
mgos_lock();
|
||||||
}
|
}
|
||||||
mgos_unlock();
|
mgos_unlock();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user