mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Stop reading if connection is closing
CL: none PUBLISHED_FROM=3b74ca02e2960bbbf130f6d95aef679f2917e824
This commit is contained in:
1 parent
93286836f9
commit
3130e59244
3 files changed
+9
-5
No files matched your search
+4
-2
@@ -578,7 +578,7 @@ static int mg_do_recv(struct mg_connection *nc) {
|
||||
} else {
|
||||
res = mg_recv_tcp(nc, buf, len);
|
||||
}
|
||||
} while (res > 0);
|
||||
} while (res > 0 && !(nc->flags & (MG_F_CLOSE_IMMEDIATELY | MG_F_UDP)));
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -695,7 +695,9 @@ static int mg_recv_udp(struct mg_connection *nc, char *buf, size_t len) {
|
||||
mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, n, MG_EV_RECV);
|
||||
}
|
||||
#endif
|
||||
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
||||
if (n != 0) {
|
||||
mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &n);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
Reference in new issue
Block a user