nghttpx: Convert SerialEventType to enum class

This commit is contained in:
Tatsuhiro Tsujikawa 2018-10-17 08:56:59 +09:00
parent 1abfa3ca5f
commit 0963f38935
2 changed files with 13 additions and 8 deletions

View File

@ -828,7 +828,7 @@ void ConnectionHandler::handle_serial_event() {
for (auto &sev : q) {
switch (sev.type) {
case SEV_REPLACE_DOWNSTREAM:
case SerialEventType::REPLACE_DOWNSTREAM:
// Mmake sure that none of worker uses
// get_config()->conn.downstream
mod_config()->conn.downstream = sev.downstreamconf;
@ -841,6 +841,8 @@ void ConnectionHandler::handle_serial_event() {
worker_replace_downstream(sev.downstreamconf);
break;
default:
break;
}
}
@ -848,7 +850,8 @@ void ConnectionHandler::handle_serial_event() {
void ConnectionHandler::send_replace_downstream(
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) {

View File

@ -84,17 +84,18 @@ struct OCSPUpdateContext {
};
// SerialEvent is an event sent from Worker thread.
enum SerialEventType {
SEV_NONE,
SEV_REPLACE_DOWNSTREAM,
enum class SerialEventType {
NONE,
REPLACE_DOWNSTREAM,
};
struct SerialEvent {
// 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) {}
int type;
SerialEventType type;
std::shared_ptr<DownstreamConfig> downstreamconf;
};
@ -163,7 +164,8 @@ public:
void set_neverbleed(neverbleed_t *nb);
#endif // HAVE_NEVERBLEED
// Send SerialEvent SEV_REPLACE_DOWNSTREAM to this object.
// Send SerialEvent SerialEventType::REPLACE_DOWNSTREAM to this
// object.
void send_replace_downstream(
const std::shared_ptr<DownstreamConfig> &downstreamconf);
// Internal function to send |ev| to this object.