From 7d89511fda49bf1f4b28d24689c81a64149373ce Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 30 Aug 2019 09:38:18 -0700 Subject: [PATCH] JSON fix --- root/root.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/root/root.cpp b/root/root.cpp index 623ce2666..4e46a0c82 100644 --- a/root/root.cpp +++ b/root/root.cpp @@ -736,8 +736,13 @@ int main(int argc,char **argv) std::ostringstream o; o << '['; { + bool first = true; std::lock_guard l(peersByIdentity_l); for(auto p=peersByIdentity.begin();p!=peersByIdentity.end();++p) { + if (first) { + first = false; + o << ','; + } o << "{\"address\":\"" << p->first.address().toString(tmp) << "\"" ",\"latency\":-1" @@ -753,6 +758,8 @@ int main(int argc,char **argv) ",\"trustedPathId\":0}"; } if (p->second->ip6) { + if (p->second->ip4) + o << ','; o << "{\"active\":true" ",\"address\":\"" << p->second->ip6.toIpString(tmp) << "\\/" << p->second->ip6.port() << "\""