26 lines
No EOL
752 B
C++
26 lines
No EOL
752 B
C++
#include "Peer.hpp"
|
|
|
|
|
|
Peer::Peer() : Peer(std::array<std::uint8_t, 2048>()) {}
|
|
|
|
|
|
Peer::Peer(const std::array<std::uint8_t, 2048>& cryptoRsaPublicKey) {
|
|
this->id = randomDistribution(randomGenerator);
|
|
this->channel = 0;
|
|
this->serverEnabled = false;
|
|
this->status = drp::task::TaskType::UNDEFINED;
|
|
|
|
this->latencyAverage = std::chrono::high_resolution_clock::duration::max();
|
|
|
|
this->cryptoRsaPublicKey = cryptoRsaPublicKey;
|
|
}
|
|
|
|
|
|
std::random_device Peer::randomDevice = std::random_device();
|
|
|
|
std::mt19937 Peer::randomGenerator = std::mt19937(randomDevice());
|
|
|
|
std::uniform_int_distribution<std::uint32_t> Peer::randomDistribution = std::uniform_int_distribution<std::uint32_t>(
|
|
1,
|
|
std::numeric_limits<std::uint32_t>::max()
|
|
); |