mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-28 13:49:01 +08:00
Handle orderly shutdown of remote sockets
When getting a EOF from remote, do not close immediately, drain the send buffer. PUBLISHED_FROM=e06cdaa2abc0d67d5d88bf3e72d887590a7aeccf
This commit is contained in:
parent
203d4a79e2
commit
8a81dce0c1
@ -3429,7 +3429,10 @@ static void mg_read_from_socket(struct mg_connection *conn) {
|
||||
} else {
|
||||
MG_FREE(buf);
|
||||
}
|
||||
if (mg_is_error(n)) {
|
||||
if (n == 0) {
|
||||
/* Orderly shutdown of the socket, try flushing output. */
|
||||
conn->flags |= MG_F_SEND_AND_CLOSE;
|
||||
} else if (mg_is_error(n)) {
|
||||
conn->flags |= MG_F_CLOSE_IMMEDIATELY;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user