diff options
author | David Timber <mieabby@gmail.com> | 2021-04-26 18:00:52 +1000 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2021-04-26 18:00:52 +1000 |
commit | 9cc889d0ac25f4e9783a87f3f6cb0bcfa79c5c88 (patch) | |
tree | 12659bd5577977c820ab991cebb46b291136bb92 /src/htbt.c | |
parent | 7e065471e598c9bc0a1799ff2caa8c799d76c003 (diff) |
Tweak and bug fix
* Increase socket operation timeout of htbt and resolv
* htbt: use of term "jitter"
* htbt: Fix bug where debug print is not suppresses when `PRNE_VERBOSE <
PRNE_VL_DBG0`
* Fix crash bug caused by SIGPIPE
* Proone: `sleep(1)` when fork fails
Diffstat (limited to 'src/htbt.c')
-rw-r--r-- | src/htbt.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -22,10 +22,10 @@ // Hover Max Redirection count #define HTBT_HOVER_MAX_REDIR 5 -// CNCP interval: HTBT_CNCP_INT_MIN + variance +// CNCP interval: HTBT_CNCP_INT_MIN + jitter // between 30 minutes and an hour #define HTBT_CNCP_INT_MIN 1800000 // half an hour minimum interval -#define HTBT_CNCP_INT_VAR 1800000 // half an hour variance +#define HTBT_CNCP_INT_JIT 1800000 // half an hour jitter #define HTBT_LBD_PORT prne_htobe16(PRNE_HTBT_PROTO_PORT) #define HTBT_LBD_BACKLOG 4 #define HTBT_LBD_MAX_CLIENTS 5 @@ -855,7 +855,7 @@ static void htbt_slv_consume_outbuf ( } prne_dbgpf("\n"); } - else { + else if (PRNE_VERBOSE >= PRNE_VL_DBG0) { prne_dbgpf( HTBT_NT_SLV"@%"PRIuPTR": > %d bytes.\n", (uintptr_t)ctx, @@ -1560,7 +1560,7 @@ static void *htbt_slv_entry (void *p) { } prne_dbgpf("\n"); } - else { + else if (PRNE_VERBOSE >= PRNE_VL_DBG0) { prne_dbgpf( HTBT_NT_SLV"@%"PRIuPTR": < %d bytes.\n", (uintptr_t)ctx, @@ -2182,7 +2182,7 @@ static void htbt_cncp_stream_slv ( } prne_dbgpf("\n"); } - else { + else if (PRNE_VERBOSE >= PRNE_VL_DBG0) { prne_dbgpf( HTBT_NT_CNCP"@%"PRIuPTR": < %zu bytes.\n", (uintptr_t)ctx, @@ -2359,13 +2359,13 @@ static void *htbt_cncp_entry (void *p) { while (ctx->loop_flag) { htbt_cncp_do_probe(ctx); - // calc interval variance + // calc interval jitter intvar = 0; // ignore failure of mbedtls_ctr_drbg_random() mbedtls_ctr_drbg_random( ctx->param.ctr_drbg, (unsigned char*)&intvar, sizeof(intvar)); - intvar = HTBT_CNCP_INT_MIN + (intvar % HTBT_CNCP_INT_VAR); + intvar = HTBT_CNCP_INT_MIN + (intvar % HTBT_CNCP_INT_JIT); pth_event_free(ev, FALSE); ev = pth_event( PTH_EVENT_TIME, |