From: Ricardo Dias Date: Tue, 15 Jan 2019 15:33:34 +0000 (+0000) Subject: msg/async: msgr2: fix keepalive_ack message X-Git-Tag: v14.1.0~271^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=467571972b23c938789195a869dc3716efc9c4e2;p=ceph.git msg/async: msgr2: fix keepalive_ack message Signed-off-by: Ricardo Dias --- diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 4bfe17b984d7..4689943f9eb3 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -375,6 +375,14 @@ struct KeepAliveFrame : public SignedEncryptedFrame { inline utime_t ×tamp() { return get_val<0>(); } }; +struct KeepAliveFrameAck + : public SignedEncryptedFrame { + const ProtocolV2::Tag tag = ProtocolV2::Tag::KEEPALIVE2_ACK; + using SignedEncryptedFrame::SignedEncryptedFrame; + + inline utime_t ×tamp() { return get_val<0>(); } +}; + struct AckFrame : public SignedEncryptedFrame { const ProtocolV2::Tag tag = ProtocolV2::Tag::ACK; using SignedEncryptedFrame::SignedEncryptedFrame; @@ -735,7 +743,7 @@ void ProtocolV2::send_message(Message *m) { void ProtocolV2::send_keepalive() { ldout(cct, 10) << __func__ << dendl; std::lock_guard l(connection->write_lock); - if (can_write) { + if (state != CLOSED) { keepalive = true; connection->center->dispatch_event_external(connection->write_handler); } @@ -868,7 +876,7 @@ void ProtocolV2::append_keepalive() { } void ProtocolV2::append_keepalive_ack(utime_t ×tamp) { - KeepAliveFrame keepalive_ack_frame(this, timestamp); + KeepAliveFrameAck keepalive_ack_frame(this, timestamp); connection->outcoming_bl.claim_append(keepalive_ack_frame.get_buffer()); } @@ -1988,7 +1996,7 @@ CtPtr ProtocolV2::handle_keepalive2(char *payload, uint32_t length) { CtPtr ProtocolV2::handle_keepalive2_ack(char *payload, uint32_t length) { ldout(cct, 20) << __func__ << " payload_len=" << length << dendl; - KeepAliveFrame keepalive_ack_frame(this, payload, length); + KeepAliveFrameAck keepalive_ack_frame(this, payload, length); connection->set_last_keepalive_ack(keepalive_ack_frame.timestamp()); ldout(cct, 20) << __func__ << " got KEEPALIVE_ACK" << dendl;