From 55a66f6408042abfd102f92fd0072a000d8e0235 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 15 Aug 2015 11:53:55 +0200 Subject: Add cluster handling for announcements --- src/ConfigParser.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/ConfigParser.cpp') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 5290b0f..7840a60 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -37,6 +37,8 @@ #endif #include +#include +#include #include #include #include @@ -261,6 +263,32 @@ void parse_ptree(boost::property_tree::ptree& pt, } } + auto clusterlist = pt_service.get("announcements.clusters", ""); + vector clusters_s; + boost::split(clusters_s, + clusterlist, + boost::is_any_of(",")); + + for (const auto& cluster_s : clusters_s) { + if (cluster_s == "") { + continue; + } + try { + service->clusters.push_back(std::stoi(cluster_s)); + } + catch (std::logic_error& e) { + etiLog.level(warn) << "Cannot parse '" << clusterlist << + "' announcement clusters for service " << serviceuid << + ": " << e.what(); + } + } + + if (service->ASu != 0 and service->clusters.empty()) { + etiLog.level(warn) << "Cluster list for service " << serviceuid << + "is empty, but announcements are defined"; + } + + int success = -5; string servicelabel = pt_service.get("label"); -- cgit v1.2.3