crimson/net: no open connections in accepting_conns
authorYingxin <yingxin.cheng@intel.com>
Wed, 21 Nov 2018 21:40:58 +0000 (05:40 +0800)
committerYingxin <yingxin.cheng@intel.com>
Thu, 20 Dec 2018 19:09:05 +0000 (03:09 +0800)
It should an atomic operation to move the connection from
accepting_conns to connections when switch to the open state.

Signed-off-by: Yingxin <yingxin.cheng@intel.com>
src/crimson/net/SocketConnection.cc

index 306ec60119a2930ab87b625af626a2b62c23828a..e0d4c36b9156bf3c73f81feba575ebc70af20bc1 100644 (file)
@@ -533,8 +533,6 @@ SocketConnection::send_connect_reply_ready(msgr_tag_t tag,
         return socket->flush();
       }
     }).then([this] {
-      messenger.register_conn(this);
-      messenger.unaccept_conn(this);
       return stop_t::yes;
     });
 }
@@ -889,6 +887,8 @@ SocketConnection::accept(seastar::connected_socket&& fd,
               return dispatcher.ms_handle_accept(this);
             });
         }).then([this] {
+          messenger.register_conn(this);
+          messenger.unaccept_conn(this);
           execute_open();
         }).handle_exception([this] (std::exception_ptr eptr) {
           // TODO: handle fault in the accepting state