Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Nov 4, 2024
1 parent a0087c2 commit 29ba56c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/fdb5/remote/Connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions src/fdb5/remote/server/ServerConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/

#include <chrono>
#include <random>
#include <thread>

#include "eckit/config/Resource.h"
#include "eckit/maths/Functions.h"
Expand Down Expand Up @@ -264,6 +266,12 @@ void ServerConnection::initialiseConnections() {
ASSERT(dataSocketFuture.valid());
dataSocketFuture.wait();

std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<int> 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
Expand Down

0 comments on commit 29ba56c

Please sign in to comment.