- Fix arm compiler warning. GCC treats chars as unsigned in this arch.

- Fix race condition in json metrics.
master
faluco 3 years ago committed by faluco
parent 17e015df62
commit a8f58f503c

@ -94,7 +94,8 @@ static std::string escape_string(const std::string& s)
fmt::format_to(buff, "\\t"); fmt::format_to(buff, "\\t");
break; break;
default: default:
if ('\x00' <= c && c <= '\x1f') { // Cast to signed char for machines that treat chars as an unsigned type.
if ((signed char)c >= '\x00' && (signed char)c <= '\x1f') {
fmt::format_to(buff, "\\u{:04x}", c); fmt::format_to(buff, "\\u{:04x}", c);
} else { } else {
buff.push_back(c); buff.push_back(c);

@ -26,10 +26,9 @@ namespace srsenb {
class metrics_json : public srsran::metrics_listener<enb_metrics_t> class metrics_json : public srsran::metrics_listener<enb_metrics_t>
{ {
public: public:
metrics_json(srslog::log_channel& c) : log_c(c) {} metrics_json(srslog::log_channel& c, enb_metrics_interface* enb_) : log_c(c), enb(enb_) {}
void set_metrics(const enb_metrics_t& m, const uint32_t period_usec) override; void set_metrics(const enb_metrics_t& m, const uint32_t period_usec) override;
void set_handle(enb_metrics_interface* enb_);
void stop() override {} void stop() override {}
private: private:

@ -607,10 +607,9 @@ int main(int argc, char* argv[])
metrics_file.set_handle(enb.get()); metrics_file.set_handle(enb.get());
} }
srsenb::metrics_json json_metrics(json_channel); srsenb::metrics_json json_metrics(json_channel, enb.get());
if (args.general.report_json_enable) { if (args.general.report_json_enable) {
metricshub.add_listener(&json_metrics); metricshub.add_listener(&json_metrics);
json_metrics.set_handle(enb.get());
} }
// create input thread // create input thread

@ -15,11 +15,6 @@
using namespace srsenb; using namespace srsenb;
void metrics_json::set_handle(enb_metrics_interface* enb_)
{
enb = enb_;
}
namespace { namespace {
/// Bearer container metrics. /// Bearer container metrics.

Loading…
Cancel
Save