mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
refactor: Use NodeClock::time_point for CNetMessage::m_time
The field is not a duration, but a time point. This will add two temporary calls to time_since_epoch(), which are fixed in the next commit.
This commit is contained in:
@@ -237,7 +237,8 @@ class CNetMessage
|
||||
{
|
||||
public:
|
||||
DataStream m_recv; //!< received message data
|
||||
std::chrono::microseconds m_time{0}; //!< time of message receipt
|
||||
/// time of message receipt
|
||||
NodeClock::time_point m_time{NodeClock::epoch};
|
||||
uint32_t m_message_size{0}; //!< size of the payload
|
||||
uint32_t m_raw_message_size{0}; //!< used wire size of the message (including header/checksum)
|
||||
std::string m_type;
|
||||
@@ -291,7 +292,7 @@ public:
|
||||
* If reject_message=true is returned the message itself is invalid, but (other than false
|
||||
* returned by ReceivedBytes) the transport is not in an inconsistent state.
|
||||
*/
|
||||
virtual CNetMessage GetReceivedMessage(std::chrono::microseconds time, bool& reject_message) = 0;
|
||||
virtual CNetMessage GetReceivedMessage(NodeClock::time_point time, bool& reject_message) = 0;
|
||||
|
||||
// 2. Sending side functions, for converting messages into bytes to be sent over the wire.
|
||||
|
||||
@@ -443,7 +444,7 @@ public:
|
||||
return ret >= 0;
|
||||
}
|
||||
|
||||
CNetMessage GetReceivedMessage(std::chrono::microseconds time, bool& reject_message) override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
|
||||
CNetMessage GetReceivedMessage(NodeClock::time_point time, bool& reject_message) override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
|
||||
|
||||
bool SetMessageToSend(CSerializedNetMsg& msg) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
|
||||
BytesToSend GetBytesToSend(bool have_next_message) const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
|
||||
@@ -652,7 +653,7 @@ public:
|
||||
// Receive side functions.
|
||||
bool ReceivedMessageComplete() const noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
|
||||
bool ReceivedBytes(std::span<const uint8_t>& msg_bytes) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex, !m_send_mutex);
|
||||
CNetMessage GetReceivedMessage(std::chrono::microseconds time, bool& reject_message) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
|
||||
CNetMessage GetReceivedMessage(NodeClock::time_point time, bool& reject_message) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_recv_mutex);
|
||||
|
||||
// Send side functions.
|
||||
bool SetMessageToSend(CSerializedNetMsg& msg) noexcept override EXCLUSIVE_LOCKS_REQUIRED(!m_send_mutex);
|
||||
|
||||
Reference in New Issue
Block a user