Commit 7ca5962d authored by Sergey Lyubka's avatar Sergey Lyubka

in pull_all() and read_request(), respect ctx->stop_flag()

parent 8ce1562f
......@@ -1528,7 +1528,7 @@ static int pull(FILE *fp, struct mg_connection *conn, char *buf, int len) {
static int pull_all(FILE *fp, struct mg_connection *conn, char *buf, int len) {
int n, nread = 0;
while (len > 0) {
while (len > 0 && conn->ctx->stop_flag == 0) {
n = pull(fp, conn, buf + nread, len);
if (n < 0) {
nread = n; // Propagate the error
......@@ -3052,7 +3052,8 @@ static int read_request(FILE *fp, struct mg_connection *conn,
int request_len, n = 0;
request_len = get_request_len(buf, *nread);
while (*nread < bufsiz && request_len == 0 &&
while (conn->ctx->stop_flag == 0 &&
*nread < bufsiz && request_len == 0 &&
(n = pull(fp, conn, buf + *nread, bufsiz - *nread)) > 0) {
*nread += n;
assert(*nread <= bufsiz);
......
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