@@ -41,17 +41,23 @@ namespace con
41
41
/* defines used for debugging and profiling */
42
42
/* *****************************************************************************/
43
43
#ifdef NDEBUG
44
- #define LOG (a ) a
45
- #define PROFILE (a )
44
+ #define LOG (a ) a
45
+ #define PROFILE (a )
46
46
#else
47
- /* this mutex is used to achieve log message consistency */
48
- std::mutex log_message_mutex;
49
- #define LOG (a ) \
50
- { \
51
- MutexAutoLock loglock (log_message_mutex); \
52
- a; \
53
- }
54
- #define PROFILE (a ) a
47
+ #if 0
48
+ /* this mutex is used to achieve log message consistency */
49
+ std::mutex log_message_mutex;
50
+ #define LOG(a) \
51
+ { \
52
+ MutexAutoLock loglock(log_message_mutex); \
53
+ a; \
54
+ }
55
+ #else
56
+ // Prevent deadlocks until a solution is found after 5.2.0 (TODO)
57
+ #define LOG (a ) a
58
+ #endif
59
+
60
+ #define PROFILE (a ) a
55
61
#endif
56
62
57
63
#define PING_TIMEOUT 5.0
@@ -1073,6 +1079,10 @@ bool UDPPeer::processReliableSendCommand(
1073
1079
FATAL_ERROR_IF (!successfully_put_back_sequence_number, " error" );
1074
1080
}
1075
1081
1082
+ // DO NOT REMOVE n_queued! It avoids a deadlock of async locked
1083
+ // 'log_message_mutex' and 'm_list_mutex'.
1084
+ u32 n_queued = channels[c.channelnum ].outgoing_reliables_sent .size ();
1085
+
1076
1086
LOG (dout_con<<m_connection->getDesc ()
1077
1087
<< " Windowsize exceeded on reliable sending "
1078
1088
<< c.data .getSize () << " bytes"
@@ -1081,7 +1091,7 @@ bool UDPPeer::processReliableSendCommand(
1081
1091
<< std::endl << " \t\t got at most : "
1082
1092
<< packets_available << " packets"
1083
1093
<< std::endl << " \t\t packets queued : "
1084
- << channels[c. channelnum ]. outgoing_reliables_sent . size ()
1094
+ << n_queued
1085
1095
<< std::endl);
1086
1096
1087
1097
return false ;
0 commit comments