More C++17
This commit is contained in:
+24
-24
@@ -78,8 +78,8 @@ public:
|
||||
virtual size_t size() const override { return sizeof(P2PClient); }
|
||||
|
||||
void reset() override;
|
||||
bool on_connect() override;
|
||||
bool on_read(char* data, uint32_t size) override;
|
||||
[[nodiscard]] bool on_connect() override;
|
||||
[[nodiscard]] bool on_read(char* data, uint32_t size) override;
|
||||
void on_read_failed(int err) override;
|
||||
void on_disconnected() override;
|
||||
|
||||
@@ -99,28 +99,28 @@ public:
|
||||
CHALLENGE_DIFFICULTY = 10000,
|
||||
};
|
||||
|
||||
bool send_handshake_challenge();
|
||||
[[nodiscard]] bool send_handshake_challenge();
|
||||
void send_handshake_solution(const uint8_t (&challenge)[CHALLENGE_SIZE]);
|
||||
bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]);
|
||||
[[nodiscard]] bool check_handshake_solution(const hash& solution, const uint8_t (&solution_salt)[CHALLENGE_SIZE]);
|
||||
|
||||
bool on_handshake_challenge(const uint8_t* buf);
|
||||
bool on_handshake_solution(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_handshake_challenge(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_handshake_solution(const uint8_t* buf);
|
||||
void on_after_handshake(uint8_t* &p);
|
||||
bool on_listen_port(const uint8_t* buf);
|
||||
bool on_block_request(const uint8_t* buf);
|
||||
bool on_block_response(const uint8_t* buf, uint32_t size, uint64_t expected_id);
|
||||
bool on_block_broadcast(const uint8_t* buf, uint32_t size, bool compact);
|
||||
bool on_peer_list_request(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_listen_port(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_block_request(const uint8_t* buf);
|
||||
[[nodiscard]] bool on_block_response(const uint8_t* buf, uint32_t size, uint64_t expected_id);
|
||||
[[nodiscard]] bool on_block_broadcast(const uint8_t* buf, uint32_t size, bool compact);
|
||||
[[nodiscard]] bool on_peer_list_request(const uint8_t* buf);
|
||||
void on_peer_list_response(const uint8_t* buf);
|
||||
void on_block_notify(const uint8_t* buf);
|
||||
|
||||
bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
|
||||
[[nodiscard]] bool handle_incoming_block_async(const PoolBlock* block, uint64_t max_time_delta = 0);
|
||||
void handle_incoming_block(p2pool* pool, PoolBlock& block, std::vector<hash>& missing_blocks, bool& result);
|
||||
void post_handle_incoming_block(p2pool* pool, const PoolBlock& block, const uint32_t reset_counter, bool is_v6, const raw_ip& addr, std::vector<hash>& missing_blocks, const bool result);
|
||||
|
||||
bool is_good() const { return m_handshakeComplete && !m_handshakeInvalid && (m_listenPort >= 0); }
|
||||
[[nodiscard]] bool is_good() const { return m_handshakeComplete && !m_handshakeInvalid && (m_listenPort >= 0); }
|
||||
|
||||
const char* software_name() const;
|
||||
[[nodiscard]] const char* software_name() const;
|
||||
|
||||
alignas(8) char m_p2pReadBuf[P2P_BUF_SIZE];
|
||||
|
||||
@@ -157,30 +157,30 @@ public:
|
||||
};
|
||||
|
||||
void broadcast(const PoolBlock& block, const PoolBlock* parent);
|
||||
uint64_t get_random64();
|
||||
uint64_t get_peerId() const { return m_peerId; }
|
||||
[[nodiscard]] uint64_t get_random64();
|
||||
[[nodiscard]] uint64_t get_peerId() const { return m_peerId; }
|
||||
|
||||
void print_status() override;
|
||||
void show_peers_async();
|
||||
size_t peer_list_size() const { MutexLock lock(m_peerListLock); return m_peerList.size(); }
|
||||
[[nodiscard]] size_t peer_list_size() const { MutexLock lock(m_peerListLock); return m_peerList.size(); }
|
||||
|
||||
int external_listen_port() const override;
|
||||
[[nodiscard]] int external_listen_port() const override;
|
||||
|
||||
uint32_t max_outgoing_peers() const { return m_maxOutgoingPeers; }
|
||||
uint32_t max_incoming_peers() const { return m_maxIncomingPeers; }
|
||||
[[nodiscard]] uint32_t max_outgoing_peers() const { return m_maxOutgoingPeers; }
|
||||
[[nodiscard]] uint32_t max_incoming_peers() const { return m_maxIncomingPeers; }
|
||||
|
||||
void set_max_outgoing_peers(uint32_t n) { m_maxOutgoingPeers = std::min(std::max(n, 10U), 450U); }
|
||||
void set_max_incoming_peers(uint32_t n) { m_maxIncomingPeers = std::min(std::max(n, 10U), 450U); }
|
||||
|
||||
int deserialize_block(const uint8_t* buf, uint32_t size, bool compact, uint64_t received_timestamp);
|
||||
const PoolBlock* get_block() const { return m_block; }
|
||||
[[nodiscard]] int deserialize_block(const uint8_t* buf, uint32_t size, bool compact, uint64_t received_timestamp);
|
||||
[[nodiscard]] const PoolBlock* get_block() const { return m_block; }
|
||||
|
||||
const PoolBlock* find_block(const hash& id) const;
|
||||
[[nodiscard]] const PoolBlock* find_block(const hash& id) const;
|
||||
|
||||
void check_for_updates(bool forced = false) const;
|
||||
|
||||
private:
|
||||
const char* get_log_category() const override;
|
||||
[[nodiscard]] const char* get_log_category() const override;
|
||||
|
||||
p2pool* m_pool;
|
||||
BlockCache* m_cache;
|
||||
|
||||
Reference in New Issue
Block a user