diff --git a/VERSION b/VERSION index fccd8bbd0..97954dceb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.11.124 \ No newline at end of file +5.11.125 \ No newline at end of file diff --git a/src/fdb5/remote/client/ClientConnection.cc b/src/fdb5/remote/client/ClientConnection.cc index b5244ca40..dd82f63e4 100644 --- a/src/fdb5/remote/client/ClientConnection.cc +++ b/src/fdb5/remote/client/ClientConnection.cc @@ -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); diff --git a/src/fdb5/remote/server/ServerConnection.cc b/src/fdb5/remote/server/ServerConnection.cc index a72d92d8b..fb872b0a1 100644 --- a/src/fdb5/remote/server/ServerConnection.cc +++ b/src/fdb5/remote/server/ServerConnection.cc @@ -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; @@ -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) {