From efc0b61ba78bf2d3dd77cc1bc1ffa350255cb6a8 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 23 Jun 2017 12:27:15 +0800 Subject: [PATCH] auth/RotatingKeyRing: use std::move() to set secrets the param will be thrown away anyway. see CephxClientHandler::handle_response(). Signed-off-by: Kefu Chai --- src/auth/RotatingKeyRing.cc | 4 ++-- src/auth/RotatingKeyRing.h | 2 +- src/auth/cephx/CephxClientHandler.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/auth/RotatingKeyRing.cc b/src/auth/RotatingKeyRing.cc index ad0c0918de2b..e48127aa64b8 100644 --- a/src/auth/RotatingKeyRing.cc +++ b/src/auth/RotatingKeyRing.cc @@ -21,10 +21,10 @@ bool RotatingKeyRing::need_new_secrets(utime_t now) const return secrets.need_new_secrets(now); } -void RotatingKeyRing::set_secrets(RotatingSecrets& s) +void RotatingKeyRing::set_secrets(RotatingSecrets&& s) { Mutex::Locker l(lock); - secrets = s; + secrets = std::move(s); dump_rotating(); } diff --git a/src/auth/RotatingKeyRing.h b/src/auth/RotatingKeyRing.h index 4a5e2375f0ca..729f5c520212 100644 --- a/src/auth/RotatingKeyRing.h +++ b/src/auth/RotatingKeyRing.h @@ -41,7 +41,7 @@ public: bool need_new_secrets() const; bool need_new_secrets(utime_t now) const; - void set_secrets(RotatingSecrets& s); + void set_secrets(RotatingSecrets&& s); void dump_rotating() const; bool get_secret(const EntityName& name, CryptoKey& secret) const override; bool get_service_secret(uint32_t service_id, uint64_t secret_id, diff --git a/src/auth/cephx/CephxClientHandler.cc b/src/auth/cephx/CephxClientHandler.cc index 816b6526a009..89d4290373f5 100644 --- a/src/auth/cephx/CephxClientHandler.cc +++ b/src/auth/cephx/CephxClientHandler.cc @@ -186,7 +186,7 @@ int CephxClientHandler::handle_response(int ret, bufferlist::iterator& indata) << error << dendl; return -EINVAL; } else { - rotating_secrets->set_secrets(secrets); + rotating_secrets->set_secrets(std::move(secrets)); } } } -- 2.47.3