Skip to content

Commit f98cdcb

Browse files
committed
net: pass Span by value to CaptureMessage()
Span is lightweight and need not be passed by const reference.
1 parent 3cb9d9c commit f98cdcb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,7 +3087,7 @@ uint64_t CConnman::CalculateKeyedNetGroup(const CAddress& ad) const
30873087

30883088
void CaptureMessageToFile(const CAddress& addr,
30893089
const std::string& msg_type,
3090-
const Span<const unsigned char>& data,
3090+
Span<const unsigned char> data,
30913091
bool is_incoming)
30923092
{
30933093
// Note: This function captures the message at the time of processing,
@@ -3118,6 +3118,6 @@ void CaptureMessageToFile(const CAddress& addr,
31183118

31193119
std::function<void(const CAddress& addr,
31203120
const std::string& msg_type,
3121-
const Span<const unsigned char>& data,
3121+
Span<const unsigned char> data,
31223122
bool is_incoming)>
31233123
CaptureMessage = CaptureMessageToFile;

src/net.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,13 +1275,13 @@ class CConnman
12751275
/** Dump binary message to file, with timestamp */
12761276
void CaptureMessageToFile(const CAddress& addr,
12771277
const std::string& msg_type,
1278-
const Span<const unsigned char>& data,
1278+
Span<const unsigned char> data,
12791279
bool is_incoming);
12801280

12811281
/** Defaults to `CaptureMessageToFile()`, but can be overridden by unit tests. */
12821282
extern std::function<void(const CAddress& addr,
12831283
const std::string& msg_type,
1284-
const Span<const unsigned char>& data,
1284+
Span<const unsigned char> data,
12851285
bool is_incoming)>
12861286
CaptureMessage;
12871287

0 commit comments

Comments
 (0)