crimson/net: add target_addr to SocketConnection
authorYingxin Cheng <yingxincheng@gmail.com>
Wed, 6 Mar 2019 09:35:33 +0000 (17:35 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 5 Apr 2019 03:21:18 +0000 (11:21 +0800)
represent the peer target_addr accepted/connected

Signed-off-by: Yingxin Cheng <yingxincheng@gmail.com>
src/crimson/net/ProtocolV2.cc
src/crimson/net/SocketConnection.h

index 7b95b2779a8f1cf3e992e1fb2da32f423bdf5a6a..c0b81c833f51e0e70646d3071f8556cfece321b0 100644 (file)
@@ -65,6 +65,7 @@ void ProtocolV2::start_connect(const entity_addr_t& _peer_addr,
   ceph_assert(state == state_t::NONE);
   ceph_assert(!socket);
   conn.peer_addr = _peer_addr;
+  conn.target_addr = _peer_addr;
   conn.peer_type = _peer_type;
   // TODO: lossless policy
   conn.policy = SocketPolicy::lossy_client(0);
@@ -78,6 +79,7 @@ void ProtocolV2::start_accept(SocketFRef&& sock,
 {
   ceph_assert(state == state_t::NONE);
   ceph_assert(!socket);
+  conn.target_addr = _peer_addr;
   socket = std::move(sock);
   messenger.accept_conn(
     seastar::static_pointer_cast<SocketConnection>(conn.shared_from_this()));
index 22753500e4efb37f1ed40b951834479bc864dd6c..e24c2633e1f5eb2051e19f424f39d1c4fa4e4f9b 100644 (file)
@@ -62,6 +62,10 @@ class SocketConnection : public Connection {
   // messages sent, but not yet acked by peer
   std::queue<MessageRef> sent;
 
+  // which of the peer_addrs we're connecting to (as client)
+  // or should reconnect to (as peer)
+  entity_addr_t target_addr;
+
  public:
   SocketConnection(SocketMessenger& messenger,
                    Dispatcher& dispatcher,