diff options
author | Simon Rettberg | 2019-08-30 09:46:53 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-30 09:46:53 +0200 |
commit | 645bb4b91b06c0eb23867aab1511b080ce122d96 (patch) | |
tree | 6697e674ba14ae65fab5077cb30e3a351164bc9c /src/server/uplink.c | |
parent | [SERVER] No uplink_init when checking working state; improve logging (diff) | |
download | dnbd3-645bb4b91b06c0eb23867aab1511b080ce122d96.tar.gz dnbd3-645bb4b91b06c0eb23867aab1511b080ce122d96.tar.xz dnbd3-645bb4b91b06c0eb23867aab1511b080ce122d96.zip |
[SERVER] Introduce debug spam
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r-- | src/server/uplink.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c index 52cf417..4cea7e2 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -472,11 +472,10 @@ static void* uplink_mainloop(void *data) waitTime = uplink->rttTestResult == RTT_DOCHANGE ? 0 : -1; if ( waitTime == 0 ) { // 0 means poll, since we're about to change the server - } else if ( uplink->current.fd == -1 ) { - waitTime = 1000; } else { declare_now; waitTime = (int)timing_diffMs( &now, &nextAltCheck ); + logadd( LOG_DEBUG1, "Next %d for %s", waitTime / 1000, uplink->image->name ); if ( waitTime < 100 ) waitTime = 100; if ( waitTime > 5000 ) waitTime = 5000; } @@ -601,13 +600,14 @@ static void* uplink_mainloop(void *data) timing_set( &nextAltCheck, &now, altCheckInterval ); } } else if ( rttTestResult == RTT_NOT_REACHABLE ) { - atomic_compare_exchange_strong( &uplink->rttTestResult, &rttTestResult, RTT_IDLE ); - discoverFailCount++; - if ( uplink->current.fd == -1 && discoverFailCount > (SERVER_RTT_MAX_UNREACH / 2) ) { - logadd( LOG_DEBUG1, "Disabling %s:%d since no uplink is available", uplink->image->name, (int)uplink->image->rid ); - uplink->image->working = false; + if ( atomic_compare_exchange_strong( &uplink->rttTestResult, &rttTestResult, RTT_IDLE ) ) { + discoverFailCount++; + if ( uplink->current.fd == -1 && discoverFailCount > (SERVER_RTT_MAX_UNREACH / 2) ) { + logadd( LOG_DEBUG1, "Disabling %s:%d since no uplink is available", uplink->image->name, (int)uplink->image->rid ); + uplink->image->working = false; + } } - timing_set( &nextAltCheck, &now, (discoverFailCount < SERVER_RTT_MAX_UNREACH ? altCheckInterval : SERVER_RTT_INTERVAL_FAILED) ); + timing_set( &nextAltCheck, &now, (discoverFailCount < SERVER_RTT_MAX_UNREACH) ? altCheckInterval : SERVER_RTT_INTERVAL_FAILED ); } #ifdef _DEBUG if ( uplink->current.fd != -1 && !uplink->shutdown ) { |