|
@@ -8817,14 +8817,10 @@ static void close_socket_gracefully(struct mg_connection *conn)
|
|
int n;
|
|
int n;
|
|
#endif
|
|
#endif
|
|
struct linger linger;
|
|
struct linger linger;
|
|
- double timeout = -1.0;
|
|
|
|
|
|
|
|
if (!conn) {
|
|
if (!conn) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (conn->ctx->config[REQUEST_TIMEOUT]) {
|
|
|
|
- timeout = atoi(conn->ctx->config[REQUEST_TIMEOUT]) / 1000.0;
|
|
|
|
- }
|
|
|
|
|
|
|
|
/* Set linger option to avoid socket hanging out after close. This prevent
|
|
/* Set linger option to avoid socket hanging out after close. This prevent
|
|
* ephemeral port exhaust problem under high QPS. */
|
|
* ephemeral port exhaust problem under high QPS. */
|
|
@@ -8853,7 +8849,7 @@ static void close_socket_gracefully(struct mg_connection *conn)
|
|
* when server decides to close the connection; then when client
|
|
* when server decides to close the connection; then when client
|
|
* does recv() it gets no data back. */
|
|
* does recv() it gets no data back. */
|
|
do {
|
|
do {
|
|
- n = pull(NULL, conn, buf, sizeof(buf), timeout);
|
|
|
|
|
|
+ n = pull(NULL, conn, buf, sizeof(buf), 1E-10 /* TODO: allow 0 as timeout */);
|
|
} while (n > 0);
|
|
} while (n > 0);
|
|
#endif
|
|
#endif
|
|
|
|
|