diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-31 17:21:51 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2021-10-31 17:21:51 +0300 |
commit | e1d1558570b8beb3fe32fc86a39e7d430e54f587 (patch) | |
tree | 377d627645b231b9ef9402b0fc7776af4b75a8ba | |
parent | ed503f0b246a3e5b7a148032f3046b3561e3ad8c (diff) | |
download | libmicrohttpd-e1d1558570b8beb3fe32fc86a39e7d430e54f587.tar.gz libmicrohttpd-e1d1558570b8beb3fe32fc86a39e7d430e54f587.zip |
MHD_set_connection_option(): improved readability
Fixed error reporting
-rw-r--r-- | src/microhttpd/connection.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 83677c14..b5724f5b 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -4852,6 +4852,7 @@ MHD_set_connection_option (struct MHD_Connection *connection, | |||
4852 | { | 4852 | { |
4853 | va_list ap; | 4853 | va_list ap; |
4854 | struct MHD_Daemon *daemon; | 4854 | struct MHD_Daemon *daemon; |
4855 | unsigned int ui_val; | ||
4855 | 4856 | ||
4856 | daemon = connection->daemon; | 4857 | daemon = connection->daemon; |
4857 | switch (option) | 4858 | switch (option) |
@@ -4875,25 +4876,24 @@ MHD_set_connection_option (struct MHD_Connection *connection, | |||
4875 | connection); | 4876 | connection); |
4876 | } | 4877 | } |
4877 | va_start (ap, option); | 4878 | va_start (ap, option); |
4878 | connection->connection_timeout_ms = va_arg (ap, | 4879 | ui_val = va_arg (ap, unsigned int); |
4879 | unsigned int); | ||
4880 | va_end (ap); | 4880 | va_end (ap); |
4881 | #if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT | 4881 | #if (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT |
4882 | if ((UINT64_MAX / 2000 - 1) < connection->connection_timeout_ms) | 4882 | if ((UINT64_MAX / 2000 - 1) < ui_val) |
4883 | { | 4883 | { |
4884 | #ifdef HAVE_MESSAGES | 4884 | #ifdef HAVE_MESSAGES |
4885 | MHD_DLOG (connection->daemon, | 4885 | MHD_DLOG (connection->daemon, |
4886 | _ ("The specified connection timeout (" PRIu64 ") is too " \ | 4886 | _ ("The specified connection timeout (%u) is too " \ |
4887 | "large. Maximum allowed value (" PRIu64 ") will be used " \ | 4887 | "large. Maximum allowed value (%" PRIu64 ") will be used " \ |
4888 | "instead.\n"), | 4888 | "instead.\n"), |
4889 | connection->connection_timeout_ms, | 4889 | ui_val, |
4890 | (UINT64_MAX / 2000 - 1)); | 4890 | (UINT64_MAX / 2000 - 1)); |
4891 | #endif | 4891 | #endif |
4892 | connection->connection_timeout_ms = UINT64_MAX / 2000 - 1; | 4892 | ui_val = UINT64_MAX / 2000 - 1; |
4893 | } | 4893 | } |
4894 | else | 4894 | else |
4895 | #endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */ | 4895 | #endif /* (SIZEOF_UINT64_T - 1) <= SIZEOF_UNSIGNED_INT */ |
4896 | connection->connection_timeout_ms *= 1000; | 4896 | connection->connection_timeout_ms = ui_val * 1000; |
4897 | if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && | 4897 | if ( (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && |
4898 | (! connection->suspended) ) | 4898 | (! connection->suspended) ) |
4899 | { | 4899 | { |