|
@@ -12358,6 +12358,7 @@ close_socket_gracefully(struct mg_connection *conn)
|
|
|
} while (n > 0);
|
|
|
#endif
|
|
|
|
|
|
+#if !defined(__MACH__)
|
|
|
/* Set linger option to avoid socket hanging out after close. This
|
|
|
* prevent ephemeral port exhaust problem under high QPS. */
|
|
|
linger.l_onoff = 1;
|
|
@@ -12378,8 +12379,7 @@ close_socket_gracefully(struct mg_connection *conn)
|
|
|
} else if (error_code == ECONNRESET) {
|
|
|
/* Socket already closed by client/peer, close socket without linger */
|
|
|
} else {
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
/* Set linger timeout */
|
|
|
if (setsockopt(conn->client.sock,
|
|
|
SOL_SOCKET,
|
|
@@ -12392,6 +12392,7 @@ close_socket_gracefully(struct mg_connection *conn)
|
|
|
strerror(ERRNO));
|
|
|
}
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
/* Now we know that our FIN is ACK-ed, safe to close */
|
|
|
closesocket(conn->client.sock);
|