#include "InfoEvent.hpp" #include #include namespace drp::event { void InfoEvent::handle( Context& context, const packet::GenericPacketContent& content, sockaddr* fromAddress, const socklen_t fromAddressLength ) { const auto remotePeer = std::make_shared(); // TODO(Faraphel): first check if the peer is already in the list // do not update the time of the list if yes ! // save the remote peer information remotePeer->address = *reinterpret_cast(&fromAddress); remotePeer->addressLength = fromAddressLength; std::memcpy(&remotePeer->information, &content, sizeof(Peer)); // TODO(Faraphel): interpret the timestamp and calculate average ping // save it in the peers list context.remotePeers.push_back(remotePeer); } }