forked from Mirrorlandia_minetest/minetest
Connection: Fix deadlock in debug mode (#9550)
This commit is contained in:
parent
f7c7353a9a
commit
a0998754a7
@ -41,17 +41,23 @@ namespace con
|
|||||||
/* defines used for debugging and profiling */
|
/* defines used for debugging and profiling */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define LOG(a) a
|
#define LOG(a) a
|
||||||
#define PROFILE(a)
|
#define PROFILE(a)
|
||||||
#else
|
#else
|
||||||
/* this mutex is used to achieve log message consistency */
|
#if 0
|
||||||
std::mutex log_message_mutex;
|
/* this mutex is used to achieve log message consistency */
|
||||||
#define LOG(a) \
|
std::mutex log_message_mutex;
|
||||||
|
#define LOG(a) \
|
||||||
{ \
|
{ \
|
||||||
MutexAutoLock loglock(log_message_mutex); \
|
MutexAutoLock loglock(log_message_mutex); \
|
||||||
a; \
|
a; \
|
||||||
}
|
}
|
||||||
#define PROFILE(a) a
|
#else
|
||||||
|
// Prevent deadlocks until a solution is found after 5.2.0 (TODO)
|
||||||
|
#define LOG(a) a
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PROFILE(a) a
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PING_TIMEOUT 5.0
|
#define PING_TIMEOUT 5.0
|
||||||
@ -1073,6 +1079,10 @@ bool UDPPeer::processReliableSendCommand(
|
|||||||
FATAL_ERROR_IF(!successfully_put_back_sequence_number, "error");
|
FATAL_ERROR_IF(!successfully_put_back_sequence_number, "error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DO NOT REMOVE n_queued! It avoids a deadlock of async locked
|
||||||
|
// 'log_message_mutex' and 'm_list_mutex'.
|
||||||
|
u32 n_queued = channels[c.channelnum].outgoing_reliables_sent.size();
|
||||||
|
|
||||||
LOG(dout_con<<m_connection->getDesc()
|
LOG(dout_con<<m_connection->getDesc()
|
||||||
<< " Windowsize exceeded on reliable sending "
|
<< " Windowsize exceeded on reliable sending "
|
||||||
<< c.data.getSize() << " bytes"
|
<< c.data.getSize() << " bytes"
|
||||||
@ -1081,7 +1091,7 @@ bool UDPPeer::processReliableSendCommand(
|
|||||||
<< std::endl << "\t\tgot at most : "
|
<< std::endl << "\t\tgot at most : "
|
||||||
<< packets_available << " packets"
|
<< packets_available << " packets"
|
||||||
<< std::endl << "\t\tpackets queued : "
|
<< std::endl << "\t\tpackets queued : "
|
||||||
<< channels[c.channelnum].outgoing_reliables_sent.size()
|
<< n_queued
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user