]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async, auth: switch AuthStreamHandler::rxtx_t to std::unique_ptr.
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 24 Jan 2019 00:46:50 +0000 (01:46 +0100)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 21 Feb 2019 20:52:47 +0000 (21:52 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/auth/AuthSessionHandler.cc
src/auth/AuthSessionHandler.h
src/msg/async/ProtocolV2.cc

index 479171f77b02ee7a58096f3399583efbe48afb66..75da38a84dc5f2e2775ec20946abe96da962a882 100644 (file)
@@ -464,8 +464,8 @@ AuthStreamHandler::rxtx_t AuthStreamHandler::create_stream_handler_pair(
     ::memcpy(&tx_nonce, auth_meta.connection_secret.c_str() + 16 + sizeof(rx_nonce),
       sizeof(tx_nonce));
     return {
-      std::make_shared<AES128GCM_StreamHandler>(cct, auth_meta, rx_nonce),
-      std::make_shared<AES128GCM_StreamHandler>(cct, auth_meta, tx_nonce)
+      std::make_unique<AES128GCM_StreamHandler>(cct, auth_meta, rx_nonce),
+      std::make_unique<AES128GCM_StreamHandler>(cct, auth_meta, tx_nonce)
     };
   } else {
     return { nullptr, nullptr };
index 080f73c2d73278d515423e981adf785b2752e99a..a334ee1eac4db40e5d60b0095f84fe2b9bc69d3e 100644 (file)
@@ -78,8 +78,8 @@ struct AuthStreamHandler {
     //rxtx_t(rxtx_t&& r) : rx(std::move(rx)), tx(std::move(tx)) {}
     // Each peer can use different handlers.
     // Hmm, isn't that too much flexbility?
-    std::shared_ptr<AuthStreamHandler> rx;
-    std::shared_ptr<AuthStreamHandler> tx;
+    std::unique_ptr<AuthStreamHandler> rx;
+    std::unique_ptr<AuthStreamHandler> tx;
   };
   static rxtx_t create_stream_handler_pair(
     CephContext* ctx,
index e17b7938838d9c5549131a65dca72f3034e39a2e..975378a76a8567aa3301c8a7d6c919bd04444e02 100644 (file)
@@ -2848,7 +2848,7 @@ CtPtr ProtocolV2::reuse_connection(AsyncConnectionRef existing,
   exproto->can_write = false;
   exproto->reconnecting = reconnecting;
   exproto->replacing = true;
-  exproto->session_security = session_security;
+  std::swap(exproto->session_security, session_security);
   exproto->auth_meta = auth_meta;
   existing->state_offset = 0;
   // avoid previous thread modify event