From f70201610bda4eb346fd7bc715fea0c31c9ced21 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Tue, 30 Jun 2020 13:46:00 +0200 Subject: [PATCH] Do not attemp to find random port for non-TCP protocols --- fairmq/FairMQChannel.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fairmq/FairMQChannel.cxx b/fairmq/FairMQChannel.cxx index 38d7c133..39954ab4 100644 --- a/fairmq/FairMQChannel.cxx +++ b/fairmq/FairMQChannel.cxx @@ -671,7 +671,6 @@ void FairMQChannel::Init() bool FairMQChannel::ConnectEndpoint(const string& endpoint) { lock_guard lock(fMtx); - return fSocket->Connect(endpoint); } @@ -683,6 +682,13 @@ bool FairMQChannel::BindEndpoint(string& endpoint) if (fSocket->Bind(endpoint)) { return true; } else { + // auto-bind only implemented for TCP + size_t protocolPos = endpoint.find(':'); + string protocol = endpoint.substr(0, protocolPos); + if (protocol != "tcp") { + return false; + } + if (fAutoBind) { // number of attempts when choosing a random port int numAttempts = 0;