30 lines
648 B
C++
30 lines
648 B
C++
#include "InfoEvent.hpp"
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include "../../tasks/types.hpp"
|
|
|
|
|
|
namespace drp::event {
|
|
|
|
|
|
void InfoEvent::handle(
|
|
Context& context,
|
|
const packet::GenericPacketContent& content,
|
|
sockaddr* fromAddress,
|
|
const socklen_t fromAddressLength
|
|
) {
|
|
const auto remotePeer = std::make_shared<RemotePeer>();
|
|
|
|
remotePeer->address = *reinterpret_cast<sockaddr*>(&fromAddress);
|
|
remotePeer->addressLength = fromAddressLength;
|
|
|
|
// TODO(Faraphel): convert the memory from content to Peer.
|
|
remotePeer->information = content;
|
|
|
|
// save it in the peers list
|
|
context.remotePeers.push_back(remotePeer);
|
|
}
|
|
|
|
|
|
}
|