summaryrefslogtreecommitdiffstats
path: root/src/crimson/net/chained_dispatchers.h
blob: 712b0894b9fd257518f125be2f45e65c9acfa575 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*- 
// vim: ts=8 sw=2 smarttab

#pragma once

#include "Fwd.h"
#include "crimson/common/log.h"

namespace crimson::net {

class Dispatcher;

class ChainedDispatchers {
public:
  void assign(const dispatchers_t& _dispatchers) {
    assert(empty());
    assert(!_dispatchers.empty());
    dispatchers = _dispatchers;
  }
  void clear() {
    dispatchers.clear();
  }
  bool empty() const {
    return dispatchers.empty();
  }
  seastar::future<> ms_dispatch(crimson::net::ConnectionRef, MessageRef);
  void ms_handle_accept(crimson::net::ConnectionRef conn);
  void ms_handle_connect(crimson::net::ConnectionRef conn);
  void ms_handle_reset(crimson::net::ConnectionRef conn, bool is_replace);
  void ms_handle_remote_reset(crimson::net::ConnectionRef conn);

 private:
  dispatchers_t dispatchers;
};

}