net: pass Span by value to CaptureMessage()

Span is lightweight and need not be passed by const reference.
This commit is contained in:
Vasil Dimov 2021-07-29 17:47:15 +02:00
parent 3cb9d9c861
commit f98cdcb357
No known key found for this signature in database
GPG key ID: 54DF06F64B55CBBF
2 changed files with 4 additions and 4 deletions

View file

@ -3087,7 +3087,7 @@ uint64_t CConnman::CalculateKeyedNetGroup(const CAddress& ad) const
void CaptureMessageToFile(const CAddress& addr, void CaptureMessageToFile(const CAddress& addr,
const std::string& msg_type, const std::string& msg_type,
const Span<const unsigned char>& data, Span<const unsigned char> data,
bool is_incoming) bool is_incoming)
{ {
// Note: This function captures the message at the time of processing, // Note: This function captures the message at the time of processing,
@ -3118,6 +3118,6 @@ void CaptureMessageToFile(const CAddress& addr,
std::function<void(const CAddress& addr, std::function<void(const CAddress& addr,
const std::string& msg_type, const std::string& msg_type,
const Span<const unsigned char>& data, Span<const unsigned char> data,
bool is_incoming)> bool is_incoming)>
CaptureMessage = CaptureMessageToFile; CaptureMessage = CaptureMessageToFile;

View file

@ -1275,13 +1275,13 @@ private:
/** Dump binary message to file, with timestamp */ /** Dump binary message to file, with timestamp */
void CaptureMessageToFile(const CAddress& addr, void CaptureMessageToFile(const CAddress& addr,
const std::string& msg_type, const std::string& msg_type,
const Span<const unsigned char>& data, Span<const unsigned char> data,
bool is_incoming); bool is_incoming);
/** Defaults to `CaptureMessageToFile()`, but can be overridden by unit tests. */ /** Defaults to `CaptureMessageToFile()`, but can be overridden by unit tests. */
extern std::function<void(const CAddress& addr, extern std::function<void(const CAddress& addr,
const std::string& msg_type, const std::string& msg_type,
const Span<const unsigned char>& data, Span<const unsigned char> data,
bool is_incoming)> bool is_incoming)>
CaptureMessage; CaptureMessage;