From 79d36aa260f49716ede72cd6bea5cf10aa688651 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 17 Mar 2020 13:26:06 +0100 Subject: [SERVER] Make sure bgrWindowSize doesn't overwhelm uplink queue --- src/server/uplink.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/server/uplink.c') diff --git a/src/server/uplink.c b/src/server/uplink.c index 9bf48d3..af854d6 100644 --- a/src/server/uplink.c +++ b/src/server/uplink.c @@ -786,6 +786,8 @@ static bool sendReplicationRequest(dnbd3_uplink_t *uplink) const int lastBlockIndex = mapBytes - 1; for ( int bc = 0; bc < numNewRequests; ++bc ) { int endByte; + if ( UPLINK_MAX_QUEUE - uplink->queueLen < 10 ) + break; // Don't overload queue if ( _backgroundReplication == BGR_FULL ) { // Full mode: consider all blocks endByte = uplink->nextReplicationIndex + mapBytes; } else { // Hashblock based: Only look for match in current hash block -- cgit v1.2.3-55-g7522