remove headers, fix HTTP status, fix get /

This commit is contained in:
Sébastien Blin committed 2017-11-07 16:08:55 -05:00
1 parent 38ad5b9ef2
commit bbe922dd7d
4 files changed
+120 -85

No files matched your search

+20
View File
@@ -68,4 +68,24 @@ NodeStats::toString() const
return ss.str();
}
#if OPENDHT_PROXY_SERVER
/**
* Build a json object from a NodeStats
*/
Json::Value
NodeStats::toJson() const
{
Json::Value val;
val["good"] = static_cast<Json::LargestUInt>(good_nodes);
val["dubious"] = static_cast<Json::LargestUInt>(dubious_nodes);
val["incoming"] = static_cast<Json::LargestUInt>(incoming_nodes);
if (table_depth > 1) {
val["table_depth"] = static_cast<Json::LargestUInt>(table_depth);
unsigned long tot_nodes = 8 * std::exp2(table_depth);
val["network_size_estimation"] = static_cast<Json::LargestUInt>(tot_nodes);
}
return val;
}
#endif //OPENDHT_PROXY_SERVER
}