node: add toString()

This commit is contained in:
Adrien Béraud committed 2016-05-03 11:09:28 -04:00
1 parent 92df1f5a2b
commit 15f4ea4d88
2 files changed
+12

No files matched your search

+10
View File
@@ -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);