From: Yingxin Date: Fri, 28 Dec 2018 02:55:00 +0000 (+0800) Subject: crimson/net: don't schedule/execute send/keepalive when closing X-Git-Tag: v14.1.0~481^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b561b9615c6bd17ee5ef0b3c470da12f58e39991;p=ceph.git crimson/net: don't schedule/execute send/keepalive when closing Signed-off-by: Yingxin --- diff --git a/src/crimson/net/SocketConnection.cc b/src/crimson/net/SocketConnection.cc index cf1d5cd591d7..237653453691 100644 --- a/src/crimson/net/SocketConnection.cc +++ b/src/crimson/net/SocketConnection.cc @@ -68,6 +68,8 @@ bool SocketConnection::is_connected() seastar::future<> SocketConnection::send(MessageRef msg) { + if (state == state_t::closing) + return seastar::now(); return seastar::with_gate(pending_dispatch, [this, msg=std::move(msg)] { return do_send(std::move(msg)) .handle_exception([this] (std::exception_ptr eptr) { @@ -79,6 +81,8 @@ seastar::future<> SocketConnection::send(MessageRef msg) seastar::future<> SocketConnection::keepalive() { + if (state == state_t::closing) + return seastar::now(); return seastar::with_gate(pending_dispatch, [this] { return do_keepalive() .handle_exception([this] (std::exception_ptr eptr) { @@ -285,6 +289,8 @@ seastar::future<> SocketConnection::do_send(MessageRef msg) // TODO: retry send for lossless connection seastar::shared_future<> f = send_ready.then( [this, msg = std::move(msg)] { + if (state == state_t::closing) + return seastar::now(); return write_message(std::move(msg)); }); @@ -298,6 +304,8 @@ seastar::future<> SocketConnection::do_keepalive() { // TODO: retry keepalive for lossless connection seastar::shared_future<> f = send_ready.then([this] { + if (state == state_t::closing) + return seastar::now(); k.req.stamp = ceph::coarse_real_clock::to_ceph_timespec( ceph::coarse_real_clock::now()); return socket->write_flush(make_static_packet(k.req));