27 lines
556 B
C++
27 lines
556 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <sys/socket.h>
|
|
|
|
#include "Peer.hpp"
|
|
|
|
|
|
/**
|
|
* Contains information about a distant peer.
|
|
*/
|
|
class RemotePeer {
|
|
public:
|
|
explicit RemotePeer(const sockaddr_storage& address, socklen_t addressLength, const Peer& peer);
|
|
|
|
void update(const Peer& peer);
|
|
|
|
// communication
|
|
sockaddr_storage address {};
|
|
socklen_t addressLength;
|
|
|
|
std::chrono::high_resolution_clock::time_point latestConnection;
|
|
std::chrono::high_resolution_clock::duration latency{};
|
|
|
|
// information
|
|
Peer information;
|
|
};
|