35 lines
759 B
C++
35 lines
759 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <sys/socket.h>
|
|
|
|
#include "tasks/types.hpp"
|
|
|
|
|
|
/**
|
|
* Contains common information about a certain peer.
|
|
*/
|
|
struct Peer {
|
|
std::uint32_t id = 0;
|
|
|
|
bool serverEnabled = false;
|
|
drp::task::TaskType status = drp::task::TaskType::UNDEFINED;
|
|
std::uint8_t channel = 0;
|
|
|
|
std::chrono::high_resolution_clock::duration latencyAverage = std::chrono::high_resolution_clock::duration::max();
|
|
};
|
|
|
|
|
|
/**
|
|
* Contains information about a distant peer.
|
|
*/
|
|
struct RemotePeer {
|
|
// communication
|
|
sockaddr_storage address {};
|
|
socklen_t addressLength = 0;
|
|
|
|
std::chrono::high_resolution_clock::duration latency = std::chrono::high_resolution_clock::duration::max();
|
|
|
|
// information
|
|
Peer information;
|
|
};
|