Skip to content
Snippets Groups Projects
Commit 15f4ea4d authored by Adrien Béraud's avatar Adrien Béraud
Browse files

node: add toString()

parent 92df1f5a
Branches
Tags
No related merge requests found
......@@ -83,6 +83,8 @@ struct Node {
*/
void reset() { pinged = 0; }
std::string toString() const;
friend std::ostream& operator<< (std::ostream& s, const Node& h);
static constexpr const std::chrono::minutes NODE_GOOD_TIME {120};
......
......@@ -21,6 +21,8 @@
#include "node.h"
#include <sstream>
namespace dht {
constexpr std::chrono::minutes Node::NODE_EXPIRE_TIME;
......@@ -77,6 +79,14 @@ Node::received(time_point now, bool answer)
}
}
std::string
Node::toString() const
{
std::stringstream ss;
ss << (*this);
return ss.str();
}
std::ostream& operator<< (std::ostream& s, const Node& h)
{
s << h.id << " " << print_addr(h.ss, h.sslen);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment