aboutsummaryrefslogtreecommitdiff
path: root/src/network/connection.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/connection.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/connection.cpp')
-rw-r--r--src/network/connection.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/network/connection.cpp b/src/network/connection.cpp
index 2d3cf6e88..6fb676f25 100644
--- a/src/network/connection.cpp
+++ b/src/network/connection.cpp
@@ -41,25 +41,14 @@ namespace con
/* defines used for debugging and profiling */
/******************************************************************************/
#ifdef NDEBUG
- #define LOG(a) a
#define PROFILE(a)
#else
- #if 0
- /* this mutex is used to achieve log message consistency */
- std::mutex log_message_mutex;
- #define LOG(a) \
- { \
- MutexAutoLock loglock(log_message_mutex); \
- a; \
- }
- #else
- // Prevent deadlocks until a solution is found after 5.2.0 (TODO)
- #define LOG(a) a
- #endif
-
#define PROFILE(a) a
#endif
+// TODO: Clean this up.
+#define LOG(a) a
+
#define PING_TIMEOUT 5.0
u16 BufferedPacket::getSeqnum() const