Skip to content

Commit 084336b

Browse files
committed
client: slow down re-try after negative CREATE_CHANNEL
When a server fails a CREATE_CHANNEL following a search, this error will often recur on re-try. Still, we do not want to give up entirely as the server side may eventually correct the issue. So drop the Channel into the furthest future searchBucket
1 parent 0b3fcca commit 084336b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/clientconn.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,15 @@ void Connection::handle_CREATE_CHANNEL()
373373
log_warn_printf(io, "Server %s refuses channel to '%s' : %s\n", peerName.c_str(),
374374
chan->name.c_str(), sts.msg.c_str());
375375

376+
// add to the far future bucket to slow down a re-try loop
377+
auto laterBucket = context->currentBucket;
378+
if(laterBucket)
379+
laterBucket--;
380+
else
381+
laterBucket = context->searchBuckets.size()-1u;
382+
376383
chan->state = Channel::Searching;
377-
context->searchBuckets[context->currentBucket].push_back(chan);
384+
context->searchBuckets[laterBucket].push_back(chan);
378385

379386
} else {
380387
// server refused after we bypassed search, so can't use usual retry method.

0 commit comments

Comments
 (0)