Skip to content

Commit

Permalink
remoteFDB connection teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Jul 3, 2024
1 parent 049e11b commit 7fdc98b
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.11.124
5.11.125
17 changes: 12 additions & 5 deletions src/fdb5/remote/client/ClientConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,20 @@ bool ClientConnection::remove(uint32_t clientID) {
}

if (clients_.empty()) {
Connection::write(Message::Exit, true, 0, 0);
if (!single_) {
// if (!controlStopping_)
// Connection::write(Message::Exit, true, 0, 0);
// if (!single_ && !dataStopping_) {
// TODO make the data connection dying automatically, when there are no more async writes
Connection::write(Message::Exit, false, 0, 0);
try {
// all done - disconnecting
Connection::write(Message::Exit, false, 0, 0);
} catch(...) {
// if connection is already down, no need to escalate
}
}
try {
// all done - disconnecting
Connection::write(Message::Exit, true, 0, 0);
} catch(...) {
// if connection is already down, no need to escalate
}

ClientConnectionRouter::instance().deregister(*this);
Expand Down
38 changes: 34 additions & 4 deletions src/fdb5/remote/server/ServerConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,20 @@ void ServerConnection::handle() {
if (hdr.message == Message::Exit) {
ASSERT(hdr.clientID() == 0);

write(Message::Exit, true, 0, 0);
if (!single_) {
write(Message::Exit, false, 0, 0);
}
// if (!single_) {
// try {
// // all done - disconnecting
// Connection::write(Message::Exit, false, 0, 0);
// } catch(...) {
// // if connection is already down, no need to escalate
// }
// }
// try {
// // all done - disconnecting
// Connection::write(Message::Exit, true, 0, 0);
// } catch(...) {
// // if connection is already down, no need to escalate
// }

eckit::Log::status() << "Terminating CONTROL listener" << std::endl;
eckit::Log::info() << "Terminating CONTROL listener" << std::endl;
Expand Down Expand Up @@ -502,6 +512,26 @@ void ServerConnection::handle() {
}
ASSERT(archiveQueue_.empty());
archiveQueue_.close();

if (!single_) {
try {
// all done - disconnecting
Connection::write(Message::Exit, false, 0, 0);
} catch(...) {
// if connection is already down, no need to escalate
}
}
try {
// all done - disconnecting
Connection::write(Message::Exit, true, 0, 0);
} catch(...) {
// if connection is already down, no need to escalate
}

// write(Message::Exit, true, 0, 0);
// if (!single_) {
// write(Message::Exit, false, 0, 0);
// }
}

void ServerConnection::handleException(std::exception_ptr e) {
Expand Down

0 comments on commit 7fdc98b

Please sign in to comment.