#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;
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;
public:
SocketConnection(SocketMessenger& messenger,
- Dispatcher& dispatcher,
+ ChainedDispatchers& dispatchers,
bool is_msgr2);
~SocketConnection() override;
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;
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;
}