Minor refactoring
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 39s

This commit is contained in:
Stephen Seo 2024-09-10 18:01:45 +09:00
parent 5303bbe5fd
commit a56adb171f
2 changed files with 4 additions and 3 deletions

View file

@ -19,6 +19,8 @@
#define C_SIMPLE_HTTP_SLEEP_NANOS 1000000 #define C_SIMPLE_HTTP_SLEEP_NANOS 1000000
#define C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_NANOS 4000000000 #define C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_NANOS 4000000000
#define C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_TICKS \
(C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_NANOS / C_SIMPLE_HTTP_SLEEP_NANOS)
#define C_SIMPLE_HTTP_RECV_BUF_SIZE 1024 #define C_SIMPLE_HTTP_RECV_BUF_SIZE 1024
#define C_SIMPLE_HTTP_CONFIG_BUF_SIZE 1024 #define C_SIMPLE_HTTP_CONFIG_BUF_SIZE 1024
#define C_SIMPLE_HTTP_QUOTE_COUNT_MAX 3 #define C_SIMPLE_HTTP_QUOTE_COUNT_MAX 3

View file

@ -162,8 +162,6 @@ int main(int argc, char **argv) {
// xxxx xxx1 - config needs to be reloaded. // xxxx xxx1 - config needs to be reloaded.
unsigned int flags = 0; unsigned int flags = 0;
const size_t config_try_reload_ticks =
C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_NANOS / C_SIMPLE_HTTP_SLEEP_NANOS;
size_t config_try_reload_ticks_count = 0; size_t config_try_reload_ticks_count = 0;
unsigned int config_try_reload_attempts = 0; unsigned int config_try_reload_attempts = 0;
@ -171,7 +169,8 @@ int main(int argc, char **argv) {
nanosleep(&sleep_time, NULL); nanosleep(&sleep_time, NULL);
if ((flags & 0x1) != 0) { if ((flags & 0x1) != 0) {
++config_try_reload_ticks_count; ++config_try_reload_ticks_count;
if (config_try_reload_ticks_count >= config_try_reload_ticks) { if (config_try_reload_ticks_count
>= C_SIMPLE_HTTP_TRY_CONFIG_RELOAD_TICKS) {
config_try_reload_ticks_count = 0; config_try_reload_ticks_count = 0;
++config_try_reload_attempts; ++config_try_reload_attempts;
fprintf( fprintf(