]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/crimson/net/SocketConnection.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / crimson / net / SocketConnection.h
index 503d4e55fb049819b0902715ba6d50b348f2d930..9c977c7cf66c30e0301fdc2c395d73a3287230bc 100644 (file)
 #include <seastar/core/sharded.hh>
 
 #include "msg/Policy.h"
+#include "crimson/common/throttle.h"
 #include "crimson/net/Connection.h"
 #include "crimson/net/Socket.h"
-#include "crimson/thread/Throttle.h"
 
 namespace crimson::net {
 
-class Dispatcher;
 class Protocol;
 class SocketMessenger;
 class SocketConnection;
@@ -33,21 +32,7 @@ class SocketConnection : public Connection {
   SocketMessenger& messenger;
   std::unique_ptr<Protocol> protocol;
 
-  // if acceptor side, ephemeral_port is different from peer_addr.get_port();
-  // if connector side, ephemeral_port is different from my_addr.get_port().
-  enum class side_t {
-    none,
-    acceptor,
-    connector
-  };
-  side_t side = side_t::none;
-  uint16_t ephemeral_port = 0;
-  void set_ephemeral_port(uint16_t port, side_t _side) {
-    ephemeral_port = port;
-    side = _side;
-  }
-
-  ceph::net::Policy<crimson::thread::Throttle> policy;
+  ceph::net::Policy<crimson::common::Throttle> policy;
 
   /// the seq num of the last transmitted message
   seq_num_t out_seq = 0;
@@ -68,7 +53,7 @@ class SocketConnection : public Connection {
 
  public:
   SocketConnection(SocketMessenger& messenger,
-                   Dispatcher& dispatcher,
+                   ChainedDispatchers& dispatchers,
                    bool is_msgr2);
   ~SocketConnection() override;
 
@@ -77,6 +62,8 @@ class SocketConnection : public Connection {
   bool is_connected() const override;
 
 #ifdef UNIT_TESTS_BUILT
+  bool is_closed_clean() const override;
+
   bool is_closed() const override;
 
   bool peer_wins() const override;
@@ -88,19 +75,21 @@ class SocketConnection : public Connection {
 
   seastar::future<> keepalive() override;
 
-  seastar::future<> close() override;
+  void mark_down() override;
 
   void print(ostream& out) const override;
 
   /// start a handshake from the client's perspective,
   /// only call when SocketConnection first construct
   void start_connect(const entity_addr_t& peer_addr,
-                     const entity_type_t& peer_type);
+                     const entity_name_t& peer_name);
   /// start a handshake from the server's perspective,
   /// only call when SocketConnection first construct
   void start_accept(SocketRef&& socket,
                     const entity_addr_t& peer_addr);
 
+  seastar::future<> close_clean(bool dispatch_reset);
+
   bool is_server_side() const {
     return policy.server;
   }