forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.cc
26 lines (22 loc) · 867 Bytes
/
utils.cc
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
#include "source/server/utils.h"
#include "source/common/common/assert.h"
namespace Envoy {
namespace Server {
namespace Utility {
envoy::admin::v3::ServerInfo::State serverState(Init::Manager::State state,
bool health_check_failed) {
switch (state) {
case Init::Manager::State::Uninitialized:
return envoy::admin::v3::ServerInfo::PRE_INITIALIZING;
case Init::Manager::State::Initializing:
return envoy::admin::v3::ServerInfo::INITIALIZING;
case Init::Manager::State::Initialized:
return health_check_failed ? envoy::admin::v3::ServerInfo::DRAINING
: envoy::admin::v3::ServerInfo::LIVE;
}
IS_ENVOY_BUG("unexpected server state enum");
return envoy::admin::v3::ServerInfo::PRE_INITIALIZING;
}
} // namespace Utility
} // namespace Server
} // namespace Envoy