throw std::runtime_error(boost::str(boost::format("unable to match content with `%s`") % cd.opts.at("stringmatch")));
}
+ int weight = 0;
try {
- stoi(content);
+ weight = stoi(content);
if(!status) {
g_log<<Logger::Info<<"LUA record monitoring declaring "<<remstring<<" UP for URL "<<cd.url<<"!"<<" with WEIGHT "<<content<<"!"<<endl;
}
}
}
- setWeight(cd, content);
+ setWeight(cd, weight);
setUp(cd);
}
catch(std::exception& ne) {
}
}
- void setWeight(const CheckDesc& cd, string content){
+ void setWeight(const CheckDesc& cd, int weight){
auto statuses = d_statuses.write_lock();
auto& state = (*statuses)[cd];
- try {
- state->weight = stoi(content);
- } catch (const PDNSException& e) {
- // set weight to 0
- state->weight = 0;
- }
+ state->weight = weight;
if (state->first) {
state->first = false;
}