diff options
author | Simon Rettberg | 2020-03-17 13:26:06 +0100 |
---|---|---|
committer | Simon Rettberg | 2020-03-17 13:26:06 +0100 |
commit | 79d36aa260f49716ede72cd6bea5cf10aa688651 (patch) | |
tree | 1a32f041d2988ef2a013752b513b3446e803eca9 /src/server/uplink.c | |
parent | [SERVER] Include build type and version in RPC (diff) | |
download | dnbd3-79d36aa260f49716ede72cd6bea5cf10aa688651.tar.gz dnbd3-79d36aa260f49716ede72cd6bea5cf10aa688651.tar.xz dnbd3-79d36aa260f49716ede72cd6bea5cf10aa688651.zip |
[SERVER] Make sure bgrWindowSize doesn't overwhelm uplink queue
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r-- | src/server/uplink.c | 2 |
1 files changed, 2 insertions, 0 deletions
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 |