mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-19 08:03:14 +08:00
Minor memory optimization
Release pbuf sooner: after copying data from, before invoking user code PUBLISHED_FROM=b877c96ef602bbca26762b18b9dde17eb880d1f9
This commit is contained in:
parent
38efe632ae
commit
49ca223e9c
@ -13928,15 +13928,15 @@ static void mg_lwip_handle_recv_tcp(struct mg_connection *nc) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
if (cs->rx_offset == cs->rx_chain->len) {
|
||||
cs->rx_chain = pbuf_dechain(cs->rx_chain);
|
||||
pbuf_free(seg);
|
||||
cs->rx_offset = 0;
|
||||
}
|
||||
mgos_unlock();
|
||||
mg_if_recv_tcp_cb(nc, data, len, 1 /* own */);
|
||||
mgos_lock();
|
||||
}
|
||||
mgos_unlock();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user