From: Kefu Chai Date: Fri, 23 Jun 2017 04:27:15 +0000 (+0800) Subject: auth/RotatingKeyRing: use std::move() to set secrets X-Git-Tag: v12.1.2~1^2~46^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F15866%2Fhead;p=ceph.git auth/RotatingKeyRing: use std::move() to set secrets the param will be thrown away anyway. see CephxClientHandler::handle_response(). Signed-off-by: Kefu Chai --- 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)); } } }