diff --git a/src/fdb5/remote/server/ServerConnection.cc b/src/fdb5/remote/server/ServerConnection.cc index bacdd3c34..c75d822ab 100644 --- a/src/fdb5/remote/server/ServerConnection.cc +++ b/src/fdb5/remote/server/ServerConnection.cc @@ -168,6 +168,8 @@ void ServerConnection::initialiseConnections() { errorMsg = "Error retrieving client protocol version"; } + std::cout << "Connection from: " << endpointFromClient << " sessionId" << clientSession << std::endl; + if (errorMsg.empty() && !LibFdb5::instance().remoteProtocolVersion().check(remoteProtocolVersion, false)) { std::stringstream ss; ss << "FDB server version " << fdb5_version_str() << " - remote protocol version not supported:" << std::endl; @@ -234,6 +236,7 @@ void ServerConnection::initialiseConnections() { if (single_) { dataEndpoint = endpointFromClient; } else { + std::lock_guard lock(dataPortMutex_); dataSocket_.reset(new eckit::net::EphemeralTCPServer(selectDataPort())); ASSERT(dataSocket_->socket() != -1); diff --git a/src/fdb5/remote/server/ServerConnection.h b/src/fdb5/remote/server/ServerConnection.h index 16f10b038..21257bc19 100644 --- a/src/fdb5/remote/server/ServerConnection.h +++ b/src/fdb5/remote/server/ServerConnection.h @@ -156,6 +156,8 @@ class ServerConnection : public Connection, public Handler { private: + std::mutex dataPortMutex_; + // data connection std::unique_ptr dataSocket_; size_t dataListener_;