Selaa lähdekoodia

close_socket_gracefully does not need a timeout

bel 10 vuotta sitten
vanhempi
commit
cceda5a55c
1 muutettua tiedostoa jossa 1 lisäystä ja 5 poistoa
  1. 1 5
      src/civetweb.c

+ 1 - 5
src/civetweb.c

@@ -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