Commit 0963f389 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Convert SerialEventType to enum class

parent 1abfa3ca
...@@ -828,7 +828,7 @@ void ConnectionHandler::handle_serial_event() { ...@@ -828,7 +828,7 @@ void ConnectionHandler::handle_serial_event() {
for (auto &sev : q) { for (auto &sev : q) {
switch (sev.type) { switch (sev.type) {
case SEV_REPLACE_DOWNSTREAM: case SerialEventType::REPLACE_DOWNSTREAM:
// Mmake sure that none of worker uses // Mmake sure that none of worker uses
// get_config()->conn.downstream // get_config()->conn.downstream
mod_config()->conn.downstream = sev.downstreamconf; mod_config()->conn.downstream = sev.downstreamconf;
...@@ -841,6 +841,8 @@ void ConnectionHandler::handle_serial_event() { ...@@ -841,6 +841,8 @@ void ConnectionHandler::handle_serial_event() {
worker_replace_downstream(sev.downstreamconf); worker_replace_downstream(sev.downstreamconf);
break;
default:
break; break;
} }
} }
...@@ -848,7 +850,8 @@ void ConnectionHandler::handle_serial_event() { ...@@ -848,7 +850,8 @@ void ConnectionHandler::handle_serial_event() {
void ConnectionHandler::send_replace_downstream( void ConnectionHandler::send_replace_downstream(
const std::shared_ptr<DownstreamConfig> &downstreamconf) { const std::shared_ptr<DownstreamConfig> &downstreamconf) {
send_serial_event(SerialEvent(SEV_REPLACE_DOWNSTREAM, downstreamconf)); send_serial_event(
SerialEvent(SerialEventType::REPLACE_DOWNSTREAM, downstreamconf));
} }
void ConnectionHandler::send_serial_event(SerialEvent ev) { void ConnectionHandler::send_serial_event(SerialEvent ev) {
......
...@@ -84,17 +84,18 @@ struct OCSPUpdateContext { ...@@ -84,17 +84,18 @@ struct OCSPUpdateContext {
}; };
// SerialEvent is an event sent from Worker thread. // SerialEvent is an event sent from Worker thread.
enum SerialEventType { enum class SerialEventType {
SEV_NONE, NONE,
SEV_REPLACE_DOWNSTREAM, REPLACE_DOWNSTREAM,
}; };
struct SerialEvent { struct SerialEvent {
// ctor for event uses DownstreamConfig // ctor for event uses DownstreamConfig
SerialEvent(int type, const std::shared_ptr<DownstreamConfig> &downstreamconf) SerialEvent(SerialEventType type,
const std::shared_ptr<DownstreamConfig> &downstreamconf)
: type(type), downstreamconf(downstreamconf) {} : type(type), downstreamconf(downstreamconf) {}
int type; SerialEventType type;
std::shared_ptr<DownstreamConfig> downstreamconf; std::shared_ptr<DownstreamConfig> downstreamconf;
}; };
...@@ -163,7 +164,8 @@ public: ...@@ -163,7 +164,8 @@ public:
void set_neverbleed(neverbleed_t *nb); void set_neverbleed(neverbleed_t *nb);
#endif // HAVE_NEVERBLEED #endif // HAVE_NEVERBLEED
// Send SerialEvent SEV_REPLACE_DOWNSTREAM to this object. // Send SerialEvent SerialEventType::REPLACE_DOWNSTREAM to this
// object.
void send_replace_downstream( void send_replace_downstream(
const std::shared_ptr<DownstreamConfig> &downstreamconf); const std::shared_ptr<DownstreamConfig> &downstreamconf);
// Internal function to send |ev| to this object. // Internal function to send |ev| to this object.
......
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