From ffe64d23f82d90e3413e49e8d9dd03f220fba901 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Sat, 9 Mar 2019 01:09:21 +0100 Subject: [PATCH] msg/async, v2: introduce pre_auth buffers. Signed-off-by: Radoslaw Zarzynski --- src/msg/async/ProtocolV2.cc | 10 ++++++++++ src/msg/async/ProtocolV2.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 48fcca695c2..7dbf4d7a993 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -703,11 +703,17 @@ CtPtr ProtocolV2::read(CONTINUATION_RXBPTR_TYPE &next, next.node = std::move(buffer); ssize_t r = connection->read(len, buf, [&next, this](char *buffer, int r) { + if (unlikely(pre_auth.enabled) && r >= 0) { + pre_auth.rxbuf.append(*next.node); + } next.r = r; run_continuation(next); }); if (r <= 0) { // error or done synchronously + if (unlikely(pre_auth.enabled) && r >= 0) { + pre_auth.rxbuf.append(*next.node); + } next.r = r; return &next; } @@ -726,6 +732,10 @@ CtPtr ProtocolV2::write(const std::string &desc, CtPtr ProtocolV2::write(const std::string &desc, CONTINUATION_TYPE &next, bufferlist &buffer) { + if (unlikely(pre_auth.enabled)) { + pre_auth.txbuf.append(buffer); + } + ssize_t r = connection->write(buffer, [&next, desc, this](int r) { if (r < 0) { diff --git a/src/msg/async/ProtocolV2.h b/src/msg/async/ProtocolV2.h index afdd7a568bf..825f873e0dd 100644 --- a/src/msg/async/ProtocolV2.h +++ b/src/msg/async/ProtocolV2.h @@ -102,6 +102,12 @@ private: utime_t recv_stamp; utime_t throttle_stamp; + struct { + ceph::bufferlist rxbuf; + ceph::bufferlist txbuf; + bool enabled {true}; + } pre_auth; + bool keepalive; ostream &_conn_prefix(std::ostream *_dout); -- 2.39.5