cql server: remove connection from notifiers earlier

Remove connection from notifiers lists just before closing it to prevent
attempts to send notification on already closed connection.
This commit is contained in:
Gleb Natapov
2015-11-26 18:45:15 +02:00
committed by Avi Kivity
parent 569d288891
commit ad358300a9

View File

@@ -427,7 +427,6 @@ cql_server::connection::connection(cql_server& server, connected_socket&& fd, so
cql_server::connection::~connection() {
--_server._current_connections;
_server._notifier->unregister_connection(this);
_server._connections_list.erase(_server._connections_list.iterator_to(*this));
_server.maybe_idle();
}
@@ -452,6 +451,7 @@ future<> cql_server::connection::process()
return write_response(make_error(0, exceptions::exception_code::SERVER_ERROR, "unknown error"));
}
}).finally([this] {
_server._notifier->unregister_connection(this);
return _pending_requests_gate.close().then([this] {
return _ready_to_respond.finally([this] {
return _write_buf.close();