]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/mon:use shared_future for waiting MauthReply 30366/head
authorchunmei Liu <chunmei.liu@intel.com>
Thu, 12 Sep 2019 21:01:37 +0000 (14:01 -0700)
committerchunmei Liu <chunmei.liu@intel.com>
Fri, 13 Sep 2019 22:49:45 +0000 (15:49 -0700)
when monitor-side close the connection, msgr call MonClient
ms_handle_reset cause reply.get_future be called twice then
assert happen in promise.get_future.
promise<T...>::get_future() noexcept {
    assert(!this->_future && this->_state && !this->_task);
    return future<T...>(this);
}
use shared_promise instead of promise to solve it.

Signed-off-by: chunmei Liu <chunmei.liu@intel.com>
src/crimson/mon/MonClient.cc

index 2c236af718bd210ed2397acf483bfa949b2f5c90..10d12cb0aef066fd8cb6c4d31e5fbf630218d317 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <seastar/core/future-util.hh>
 #include <seastar/core/lowres_clock.hh>
+#include <seastar/core/shared_future.hh>
 #include <seastar/util/log.hh>
 
 #include "auth/AuthClientHandler.h"
@@ -107,7 +108,7 @@ private:
 private:
   bool closed = false;
   // v1
-  seastar::promise<Ref<MAuthReply>> reply;
+  seastar::shared_promise<Ref<MAuthReply>> reply;
   // v2
   using clock_t = seastar::lowres_system_clock;
   clock_t::time_point auth_start;
@@ -251,7 +252,7 @@ Connection::do_auth_single(Connection::request_t what)
   logger().info("sending {}", *m);
   return conn->send(m).then([this] {
     logger().info("waiting");
-    return reply.get_future();
+    return reply.get_shared_future();
   }).then([this] (Ref<MAuthReply> m) {
     if (!m) {
       ceph_assert(closed);
@@ -297,7 +298,7 @@ Connection::authenticate_v1(epoch_t epoch,
   return conn->keepalive().then([epoch, name, this] {
     return setup_session(epoch, name);
   }).then([this] {
-    return reply.get_future();
+    return reply.get_shared_future();
   }).then([name, want_keys, this](Ref<MAuthReply> m) {
     if (!m) {
       logger().error("authenticate_v1 canceled on {}", name);