From b0b0bc8d7e97bf987a8b134c4c1a18b8243ea692 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 16 Oct 2025 07:26:53 -0700 Subject: [PATCH] client: respect forcedServer on failed CREATE_CHANNEL --- src/clientconn.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/clientconn.cpp b/src/clientconn.cpp index 1be977e..2539204 100644 --- a/src/clientconn.cpp +++ b/src/clientconn.cpp @@ -381,13 +381,24 @@ void Connection::handle_CREATE_CHANNEL() chan->statRx += rxlen; if(!sts.isSuccess()) { - // server refuses to create a channel, but presumably responded positively to search + if(chan->forcedServer.family()==AF_UNSPEC) { + // server refuses to create a channel, but presumably responded positively to search. + // try again - chan->state = Channel::Searching; - context->searchBuckets[context->currentBucket].push_back(chan); + log_warn_printf(io, "Server %s refuses channel to '%s' : %s\n", peerName.c_str(), + chan->name.c_str(), sts.msg.c_str()); - log_warn_printf(io, "Server %s refuses channel to '%s' : %s\n", peerName.c_str(), - chan->name.c_str(), sts.msg.c_str()); + chan->state = Channel::Searching; + context->searchBuckets[context->currentBucket].push_back(chan); + + } else { + // server refused after we bypassed search, so can't use usual retry method. + // refuse to create a tight retry loop, and drop on the floor for now. + // retry on reconnect. + log_err_printf(io, "Server %s refuses direct channel to '%s' : %s\n", peerName.c_str(), + chan->name.c_str(), sts.msg.c_str()); + return; + } } else { chan->state = Channel::Active;