mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-19 08:03:14 +08:00
Read all available data during recv poll
CL: mg: Read all available data during recv poll PUBLISHED_FROM=b081025b9fb392c988924c7097b5333c38053f6f
This commit is contained in:
parent
91b57aa9a8
commit
93286836f9
@ -2882,6 +2882,7 @@ static int mg_do_recv(struct mg_connection *nc) {
|
||||
((nc->flags & MG_F_LISTENING) && !(nc->flags & MG_F_UDP))) {
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
len = recv_avail_size(nc, len);
|
||||
if (len == 0) return -2;
|
||||
if (nc->recv_mbuf.size < nc->recv_mbuf.len + len) {
|
||||
@ -2894,6 +2895,7 @@ static int mg_do_recv(struct mg_connection *nc) {
|
||||
} else {
|
||||
res = mg_recv_tcp(nc, buf, len);
|
||||
}
|
||||
} while (res > 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -565,6 +565,7 @@ static int mg_do_recv(struct mg_connection *nc) {
|
||||
((nc->flags & MG_F_LISTENING) && !(nc->flags & MG_F_UDP))) {
|
||||
return -1;
|
||||
}
|
||||
do {
|
||||
len = recv_avail_size(nc, len);
|
||||
if (len == 0) return -2;
|
||||
if (nc->recv_mbuf.size < nc->recv_mbuf.len + len) {
|
||||
@ -577,6 +578,7 @@ static int mg_do_recv(struct mg_connection *nc) {
|
||||
} else {
|
||||
res = mg_recv_tcp(nc, buf, len);
|
||||
}
|
||||
} while (res > 0);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user