mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-07 16:01:30 +00:00
Trim recv_mbuf when we know the size of the data
CL: none PUBLISHED_FROM=e354b67ab6f8246af50c601f5f70d36c029601ea
This commit is contained in:
1 parent
341ae53e85
commit
98f6c8aa4f
2 files changed
+4
No files matched your search
@@ -2928,10 +2928,12 @@ static int mg_recv_tcp(struct mg_connection *nc, char *buf, size_t len) {
|
|||||||
mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV);
|
mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
mbuf_trim(&nc->recv_mbuf);
|
||||||
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
||||||
} else if (n < 0) {
|
} else if (n < 0) {
|
||||||
nc->flags |= MG_F_CLOSE_IMMEDIATELY;
|
nc->flags |= MG_F_CLOSE_IMMEDIATELY;
|
||||||
}
|
}
|
||||||
|
mbuf_trim(&nc->recv_mbuf);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -619,10 +619,12 @@ static int mg_recv_tcp(struct mg_connection *nc, char *buf, size_t len) {
|
|||||||
mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV);
|
mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
mbuf_trim(&nc->recv_mbuf);
|
||||||
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
||||||
} else if (n < 0) {
|
} else if (n < 0) {
|
||||||
nc->flags |= MG_F_CLOSE_IMMEDIATELY;
|
nc->flags |= MG_F_CLOSE_IMMEDIATELY;
|
||||||
}
|
}
|
||||||
|
mbuf_trim(&nc->recv_mbuf);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user