summaryrefslogtreecommitdiff
path: root/src/network/socket.cpp
diff options
context:
space:
mode:
authorparadust7 <102263465+paradust7@users.noreply.github.com>2022-05-04 11:55:01 -0700
committerGitHub <noreply@github.com>2022-05-04 20:55:01 +0200
commit0704ca055059088bdd53e15be672e6b5663b8f50 (patch)
tree26d12dc712e19fcc38e3a70ef598efc665ab0d7f /src/network/socket.cpp
parentae7664597ed15f9ac779a9bac0595ab4125457c4 (diff)
downloadminetest-0704ca055059088bdd53e15be672e6b5663b8f50.tar.gz
minetest-0704ca055059088bdd53e15be672e6b5663b8f50.tar.bz2
minetest-0704ca055059088bdd53e15be672e6b5663b8f50.zip
Make logging cost free when there is no output target (#12247)
The logging streams now do almost no work when there is no output target for them. For example, if LL_VERBOSE has no output targets, then `verbosestream << x` will return a StreamProxy with a null target. Any further `<<` operations applied to it will do nothing.
Diffstat (limited to 'src/network/socket.cpp')
-rw-r--r--src/network/socket.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/socket.cpp b/src/network/socket.cpp
index 97a5f19f7..df15c89ba 100644
--- a/src/network/socket.cpp
+++ b/src/network/socket.cpp
@@ -198,7 +198,7 @@ void UDPSocket::Send(const Address &destination, const void *data, int size)
if (socket_enable_debug_output) {
// Print packet destination and size
dstream << (int)m_handle << " -> ";
- destination.print(&dstream);
+ destination.print(dstream);
dstream << ", size=" << size;
// Print packet contents
@@ -295,7 +295,7 @@ int UDPSocket::Receive(Address &sender, void *data, int size)
if (socket_enable_debug_output) {
// Print packet sender and size
dstream << (int)m_handle << " <- ";
- sender.print(&dstream);
+ sender.print(dstream);
dstream << ", size=" << received;
// Print packet contents