diff options
author | Simon Rettberg | 2019-08-30 09:55:41 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-30 09:55:41 +0200 |
commit | 5613ed8bf1f05c38af163c1303ab20be6b20090e (patch) | |
tree | 40fb55660c36a1a445d88f087bb8a294db53e604 /src/server/uplink.c | |
parent | [SERVER] Introduce debug spam (diff) | |
download | dnbd3-5613ed8bf1f05c38af163c1303ab20be6b20090e.tar.gz dnbd3-5613ed8bf1f05c38af163c1303ab20be6b20090e.tar.xz dnbd3-5613ed8bf1f05c38af163c1303ab20be6b20090e.zip |
[SERVER] Less debug spam, fix RTT interval calculation
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r-- | src/server/uplink.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c index 4cea7e2..d1cd2e8 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -475,9 +475,8 @@ static void* uplink_mainloop(void *data) } 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; + if ( waitTime > 10000 ) waitTime = 10000; } events[EV_SOCKET].fd = uplink->current.fd; numSocks = poll( events, EV_COUNT, waitTime ); @@ -582,7 +581,7 @@ static void* uplink_mainloop(void *data) // See if we should trigger an RTT measurement rttTestResult = uplink->rttTestResult; if ( rttTestResult == RTT_IDLE || rttTestResult == RTT_DONTCHANGE ) { - if ( timing_reached( &nextAltCheck, &now ) || uplink->current.fd == -1 || uplink->cycleDetected ) { + if ( timing_reached( &nextAltCheck, &now ) || ( uplink->current.fd == -1 && discoverFailCount == 0 ) || uplink->cycleDetected ) { // It seems it's time for a check if ( image_isComplete( uplink->image ) ) { // Quit work if image is complete @@ -606,6 +605,9 @@ static void* uplink_mainloop(void *data) logadd( LOG_DEBUG1, "Disabling %s:%d since no uplink is available", uplink->image->name, (int)uplink->image->rid ); uplink->image->working = false; } + if ( uplink->current.fd == -1 ) { + uplink->cycleDetected = false; + } } timing_set( &nextAltCheck, &now, (discoverFailCount < SERVER_RTT_MAX_UNREACH) ? altCheckInterval : SERVER_RTT_INTERVAL_FAILED ); } |