Commit 4bd075de authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Convert Http2Session state to enum class

parent b46a3249
......@@ -71,7 +71,7 @@ Http2DownstreamConnection::~Http2DownstreamConnection() {
error_code = NGHTTP2_INTERNAL_ERROR;
}
if (http2session_->get_state() == Http2Session::CONNECTED &&
if (http2session_->get_state() == Http2SessionState::CONNECTED &&
downstream_->get_downstream_stream_id() != -1) {
submit_rst_stream(downstream_, error_code);
......@@ -140,7 +140,7 @@ void Http2DownstreamConnection::detach_downstream(Downstream *downstream) {
int Http2DownstreamConnection::submit_rst_stream(Downstream *downstream,
uint32_t error_code) {
int rv = -1;
if (http2session_->get_state() == Http2Session::CONNECTED &&
if (http2session_->get_state() == Http2SessionState::CONNECTED &&
downstream->get_downstream_stream_id() != -1) {
switch (downstream->get_response_state()) {
case DownstreamState::MSG_RESET:
......@@ -534,7 +534,7 @@ int Http2DownstreamConnection::resume_read(IOCtrlReason reason,
size_t consumed) {
int rv;
if (http2session_->get_state() != Http2Session::CONNECTED) {
if (http2session_->get_state() != Http2SessionState::CONNECTED) {
return 0;
}
......
This diff is collapsed.
......@@ -72,6 +72,25 @@ enum class FreelistZone {
GONE
};
enum class Http2SessionState {
// Disconnected
DISCONNECTED,
// Connecting proxy and making CONNECT request
PROXY_CONNECTING,
// Tunnel is established with proxy
PROXY_CONNECTED,
// Establishing tunnel is failed
PROXY_FAILED,
// Connecting to downstream and/or performing SSL/TLS handshake
CONNECTING,
// Connected to downstream
CONNECTED,
// Connection is started to fail
CONNECT_FAILING,
// Resolving host name
RESOLVING_NAME,
};
class Http2Session {
public:
Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx, Worker *worker,
......@@ -135,8 +154,8 @@ public:
ev_io *get_wev();
int get_state() const;
void set_state(int state);
Http2SessionState get_state() const;
void set_state(Http2SessionState state);
void start_settings_timer();
void stop_settings_timer();
......@@ -218,25 +237,6 @@ public:
bool get_allow_connect_proto() const;
enum {
// Disconnected
DISCONNECTED,
// Connecting proxy and making CONNECT request
PROXY_CONNECTING,
// Tunnel is established with proxy
PROXY_CONNECTED,
// Establishing tunnel is failed
PROXY_FAILED,
// Connecting to downstream and/or performing SSL/TLS handshake
CONNECTING,
// Connected to downstream
CONNECTED,
// Connection is started to fail
CONNECT_FAILING,
// Resolving host name
RESOLVING_NAME,
};
enum {
// Connection checking is not required
CONNECTION_CHECK_NONE,
......@@ -283,7 +283,7 @@ private:
// Resolved IP address if dns parameter is used
std::unique_ptr<Address> resolved_addr_;
std::unique_ptr<DNSQuery> dns_query_;
int state_;
Http2SessionState state_;
int connection_check_state_;
FreelistZone freelist_zone_;
// true if SETTINGS without ACK is received from peer.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment