introduce SockAddr to store IP addresses

This commit is contained in:
Adrien Béraud committed 2016-09-15 01:38:26 -04:00
1 parent 8eaf78bfe2
commit 6d38c18572
15 files changed
+251 -207

No files matched your search

+3 -4
View File
@@ -65,10 +65,9 @@ Node::getPendingMessageCount() const
}
void
Node::update(const sockaddr* sa, socklen_t salen)
Node::update(const SockAddr& new_addr)
{
std::copy_n((const uint8_t*)sa, salen, (uint8_t*)&ss);
sslen = salen;
addr = new_addr;
}
/** To be called when a message was sent to the node */
@@ -119,7 +118,7 @@ Node::toString() const
std::ostream& operator<< (std::ostream& s, const Node& h)
{
s << h.id << " " << print_addr(h.ss, h.sslen);
s << h.id << " " << h.addr.toString();
return s;
}