diff options
author | Simon Rettberg | 2021-05-10 17:35:07 +0200 |
---|---|---|
committer | Simon Rettberg | 2021-05-10 17:35:07 +0200 |
commit | 3bcbfcdd700d333fb655ea9e91ad6a0f6b8f2159 (patch) | |
tree | c9c900fbe987355da0ddbef3d753b3cbdc931fd1 | |
parent | [KERNEL] Improve debug output in net.c (diff) | |
download | dnbd3-3bcbfcdd700d333fb655ea9e91ad6a0f6b8f2159.tar.gz dnbd3-3bcbfcdd700d333fb655ea9e91ad6a0f6b8f2159.tar.xz dnbd3-3bcbfcdd700d333fb655ea9e91ad6a0f6b8f2159.zip |
[SERVER] Honor uplinkTimeout directly when connecting to alt-server
-rw-r--r-- | src/server/altservers.c | 3 | ||||
-rw-r--r-- | src/server/image.c | 5 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/server/altservers.c b/src/server/altservers.c index 2b65def..4413ca6 100644 --- a/src/server/altservers.c +++ b/src/server/altservers.c @@ -551,7 +551,7 @@ static void altservers_findUplinkInternal(dnbd3_uplink_t *uplink) int server = servers[itAlt]; // Connect clock_gettime( BEST_CLOCK_SOURCE, &start ); - int sock = sock_connect( &altServers[server].host, 750, 1000 ); + int sock = sock_connect( &altServers[server].host, 750, _uplinkTimeout ); if ( sock == -1 ) { // Connection failed means global error altservers_serverFailed( server ); continue; @@ -654,7 +654,6 @@ failed: } else { LOG( LOG_DEBUG1, "Change - best: %luµs, current: %luµs", bestRtt, currentRtt ); } - sock_setTimeout( best.fd, _uplinkTimeout ); mutex_lock( &uplink->rttLock ); uplink->better = best; uplink->rttTestResult = RTT_DOCHANGE; diff --git a/src/server/image.c b/src/server/image.c index 644e2a1..7e5ea4a 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -1258,7 +1258,7 @@ static dnbd3_image_t *loadImageProxy(char * const name, const uint16_t revision, bool ok = false; int sock; if ( i >= count ) { - sock = sock_multiConnect( cons, NULL, 100, 1000 ); + sock = sock_multiConnect( cons, NULL, 100, _uplinkTimeout ); if ( sock == -2 ) break; } else { if ( log_hasMask( LOG_DEBUG2 ) ) { @@ -1267,7 +1267,7 @@ static dnbd3_image_t *loadImageProxy(char * const name, const uint16_t revision, host[len] = '\0'; logadd( LOG_DEBUG2, "Trying to replicate from %s", host ); } - sock = sock_multiConnect( cons, &servers[i], 100, 1000 ); + sock = sock_multiConnect( cons, &servers[i], 100, _uplinkTimeout ); } if ( sock == -1 || sock == -2 ) continue; salen = sizeof(sa); @@ -1325,7 +1325,6 @@ server_fail: ; image = image_get( name, acceptedRemoteRid, false ); if ( image != NULL && uplinkSock != -1 ) { // If so, init the uplink and pass it the socket - sock_setTimeout( uplinkSock, _uplinkTimeout ); if ( !uplink_init( image, uplinkSock, &uplinkServer, remoteProtocolVersion ) ) { close( uplinkSock ); } else { |