]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async, v2: introduce pre_auth buffers.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Sat, 9 Mar 2019 00:09:21 +0000 (01:09 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 11 Mar 2019 00:24:01 +0000 (01:24 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/msg/async/ProtocolV2.cc
src/msg/async/ProtocolV2.h

index 48fcca695c21133b3d8e2259a8ae4b644a9aa39b..7dbf4d7a9937a7a2db306cee14c0eafbcaf37e85 100644 (file)
@@ -703,11 +703,17 @@ CtPtr ProtocolV2::read(CONTINUATION_RXBPTR_TYPE<ProtocolV2> &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<ProtocolV2> &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) {
index afdd7a568bf689c1e2b957293b4614db0954be29..825f873e0dd5ac8a4503c853b5d5ed56dafbdf47 100644 (file)
@@ -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);