diff options
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r-- | src/microhttpd/daemon.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index 090d39d4..bec6d8d8 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -2008,12 +2008,13 @@ thread_main_handle_connection (void *data) | |||
2008 | else | 2008 | else |
2009 | { | 2009 | { |
2010 | const uint64_t mseconds_left = timeout - since_actv; | 2010 | const uint64_t mseconds_left = timeout - since_actv; |
2011 | #if UINT64_MAX != TIMEVAL_TV_SEC_MAX | 2011 | #if (SIZEOF_UINT64_T - 1) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC |
2012 | if (mseconds_left / 1000 > TIMEVAL_TV_SEC_MAX) | 2012 | if (mseconds_left / 1000 > TIMEVAL_TV_SEC_MAX) |
2013 | tv.tv_sec = TIMEVAL_TV_SEC_MAX; | 2013 | tv.tv_sec = TIMEVAL_TV_SEC_MAX; |
2014 | else | 2014 | else |
2015 | tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) mseconds_left / 1000; | 2015 | #endif /* (SIZEOF_UINT64_T - 1) >= SIZEOF_STRUCT_TIMEVAL_TV_SEC */ |
2016 | #endif /* UINT64_MAX != TIMEVAL_TV_SEC_MAX */ | 2016 | tv.tv_sec = (_MHD_TIMEVAL_TV_SEC_TYPE) mseconds_left / 1000; |
2017 | |||
2017 | tv.tv_usec = (mseconds_left % 1000) * 1000; | 2018 | tv.tv_usec = (mseconds_left % 1000) * 1000; |
2018 | } | 2019 | } |
2019 | tvp = &tv; | 2020 | tvp = &tv; |
@@ -8143,6 +8144,15 @@ MHD_init (void) | |||
8143 | MHD_monotonic_sec_counter_init (); | 8144 | MHD_monotonic_sec_counter_init (); |
8144 | MHD_send_init_static_vars_ (); | 8145 | MHD_send_init_static_vars_ (); |
8145 | MHD_init_mem_pools_ (); | 8146 | MHD_init_mem_pools_ (); |
8147 | /* Check whether sizes were correctly detected by configure */ | ||
8148 | #ifdef _DEBUG | ||
8149 | if (1) | ||
8150 | { | ||
8151 | struct timeval tv; | ||
8152 | mhd_assert (sizeof(tv.tv_sec) == SIZEOF_STRUCT_TIMEVAL_TV_SEC); | ||
8153 | } | ||
8154 | #endif /* _DEBUG */ | ||
8155 | mhd_assert (sizeof(uint64_t) == SIZEOF_UINT64_T); | ||
8146 | } | 8156 | } |
8147 | 8157 | ||
8148 | 8158 | ||