Commit 8a81dce0 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by rojer

Handle orderly shutdown of remote sockets

When getting a EOF from remote, do not close immediately, drain the send
buffer.

PUBLISHED_FROM=e06cdaa2abc0d67d5d88bf3e72d887590a7aeccf
parent 203d4a79
......@@ -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;
}
}
......
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