mirror of
https://github.com/joyieldInc/predixy.git
synced 2025-12-24 22:46:41 +08:00
Support multiple Latency Monitors
- Fix a dangling pointer bug
This commit is contained in:
parent
9d1d1af5bf
commit
a559ac0d4f
@ -42,7 +42,7 @@ void CustomCommandConf::init(CustomCommandConf&c, const char* name, const int ty
|
||||
}
|
||||
|
||||
void CustomCommandConf::convert(const CustomCommandConf&c, Command &cmd) {
|
||||
cmd.name = c.name.c_str();
|
||||
cmd.name = strdup(c.name.c_str());
|
||||
cmd.minArgs = c.minArgs;
|
||||
cmd.maxArgs = c.maxArgs;
|
||||
cmd.mode = c.mode;
|
||||
@ -136,7 +136,7 @@ void Conf::setGlobal(const ConfParser::Node* node)
|
||||
const ConfParser::Node* clusterServerPool = nullptr;
|
||||
const ConfParser::Node* sentinelServerPool = nullptr;
|
||||
const ConfParser::Node* dataCenter = nullptr;
|
||||
const ConfParser::Node* latencyMonitor = nullptr;
|
||||
std::vector<const ConfParser::Node*> latencyMonitors;
|
||||
for (auto p = node; p; p = p->next) {
|
||||
if (setStr(mName, "Name", p)) {
|
||||
} else if (setStr(mBind, "Bind", p)) {
|
||||
@ -165,7 +165,7 @@ void Conf::setGlobal(const ConfParser::Node* node)
|
||||
} else if (setInt(mLogSample[LogLevel::Warn], "LogWarnSample", p)) {
|
||||
} else if (setInt(mLogSample[LogLevel::Error], "LogErrorSample", p)) {
|
||||
} else if (strcasecmp(p->key.c_str(), "LatencyMonitor") == 0) {
|
||||
latencyMonitor = p;
|
||||
latencyMonitors.push_back(p);
|
||||
} else if (strcasecmp(p->key.c_str(), "Authority") == 0) {
|
||||
authority = p;
|
||||
} else if (strcasecmp(p->key.c_str(), "ClusterServerPool") == 0) {
|
||||
@ -197,7 +197,7 @@ void Conf::setGlobal(const ConfParser::Node* node)
|
||||
if (dataCenter) {
|
||||
setDataCenter(dataCenter);
|
||||
}
|
||||
if (latencyMonitor) {
|
||||
for (auto latencyMonitor : latencyMonitors) {
|
||||
mLatencyMonitors.push_back(LatencyMonitorConf{});
|
||||
setLatencyMonitor(mLatencyMonitors.back(), latencyMonitor);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user