diff --git a/src/fdb5/remote/Connection.cc b/src/fdb5/remote/Connection.cc index 2fe76c9c6..0eb998e7b 100644 --- a/src/fdb5/remote/Connection.cc +++ b/src/fdb5/remote/Connection.cc @@ -76,14 +76,11 @@ void Connection::readUnsafe(bool control, void* data, size_t length) { ss << "Read error. Expected " << length << ". Error = " << eckit::Log::syserr; throw TCPException(ss.str(), Here()); } - if (length < read) { + if (length != read) { std::stringstream ss; ss << "Read error. Expected " << length << " bytes, read " << read; throw TCPException(ss.str(), Here()); } - if (read == 0) { - readUnsafe(control,data,length); - } } eckit::Buffer Connection::read(bool control, MessageHeader& hdr) { diff --git a/src/fdb5/remote/server/ServerConnection.cc b/src/fdb5/remote/server/ServerConnection.cc index 71f683a3e..7562e4ffb 100644 --- a/src/fdb5/remote/server/ServerConnection.cc +++ b/src/fdb5/remote/server/ServerConnection.cc @@ -14,6 +14,8 @@ */ #include +#include +#include #include "eckit/config/Resource.h" #include "eckit/maths/Functions.h" @@ -264,6 +266,12 @@ void ServerConnection::initialiseConnections() { ASSERT(dataSocketFuture.valid()); dataSocketFuture.wait(); + std::random_device rd; + std::mt19937 mt(rd()); + std::uniform_int_distribution dist(0, 1000); + std::this_thread::sleep_for(std::chrono::milliseconds(dist(rd))); + + // Check the response from the client. // Ensure that the hostname matches the original hostname, and that // it returns the details we sent it