mirror of
https://github.com/lammertb/libhttp.git
synced 2025-12-22 04:02:04 +03:00
close_socket_gracefully does not need a timeout
This commit is contained in:
@@ -8817,14 +8817,10 @@ static void close_socket_gracefully(struct mg_connection *conn)
|
||||
int n;
|
||||
#endif
|
||||
struct linger linger;
|
||||
double timeout = -1.0;
|
||||
|
||||
if (!conn) {
|
||||
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
|
||||
* 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
|
||||
* does recv() it gets no data back. */
|
||||
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);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user