diff options
author | Simon Rettberg | 2019-08-22 16:14:27 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-08-22 16:14:27 +0200 |
commit | 5fb4ef278be86fb6bda487f65ec4855d830bf4e5 (patch) | |
tree | f06c1ce5466b14bb4ff47dbd2939e11b8eedf6d0 /src/server/image.c | |
parent | [SERVER] Put request handle into CMD_ERROR reply (diff) | |
download | dnbd3-5fb4ef278be86fb6bda487f65ec4855d830bf4e5.tar.gz dnbd3-5fb4ef278be86fb6bda487f65ec4855d830bf4e5.tar.xz dnbd3-5fb4ef278be86fb6bda487f65ec4855d830bf4e5.zip |
[SERVER] Get rid of alt-servers thread, per-uplink rtt history
Alt-Server checks are now run using the threadpool, so we don't need a
queue and dedicated thread anymore. The rtt history is now kept per
uplink, so many uplinks won't overwhelm the history, making its time
window very short.
Also the fail counter is now split up; a global one for when the server
actually isn't reachable, a local (per-uplink) one for when the server
is reachable but doesn't serve the requested image.
Diffstat (limited to 'src/server/image.c')
-rw-r--r-- | src/server/image.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/server/image.c b/src/server/image.c index d250715..1a6e0f8 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -1178,7 +1178,7 @@ static dnbd3_image_t *loadImageProxy(char * const name, const uint16_t revision, dnbd3_host_t servers[REP_NUM_SRV]; int uplinkSock = -1; dnbd3_host_t uplinkServer; - const int count = altservers_getListForUplink( servers, REP_NUM_SRV, false ); + const int count = altservers_getHostListForReplication( servers, REP_NUM_SRV ); uint16_t remoteProtocolVersion; uint16_t remoteRid = revision; uint64_t remoteImageSize; @@ -1491,7 +1491,7 @@ json_t* image_getListAsJson() json_t *imagesJson = json_array(); json_t *jsonImage; int i; - char uplinkName[100] = { 0 }; + char uplinkName[100]; uint64_t bytesReceived; int completeness, idleTime; declare_now; @@ -1508,7 +1508,7 @@ json_t* image_getListAsJson() uplinkName[0] = '\0'; } else { bytesReceived = image->uplink->bytesReceived; - if ( image->uplink->current.fd == -1 || !host_to_string( &image->uplink->current.host, uplinkName, sizeof(uplinkName) ) ) { + if ( !uplink_getHostString( image->uplink, uplinkName, sizeof(uplinkName) ) ) { uplinkName[0] = '\0'; } } |