forked from Mirrorlandia_minetest/minetest
RunCommandQueues: little optimization
remove command from queue on success, else do nothing, instead of remove command from queue and push it front on success
This commit is contained in:
parent
7c121726dc
commit
ab77bf98ee
@ -1190,15 +1190,18 @@ void UDPPeer::RunCommandQueues(
|
|||||||
(commands_processed < maxcommands)) {
|
(commands_processed < maxcommands)) {
|
||||||
try {
|
try {
|
||||||
ConnectionCommand c = channels[i].queued_commands.front();
|
ConnectionCommand c = channels[i].queued_commands.front();
|
||||||
channels[i].queued_commands.pop_front();
|
|
||||||
LOG(dout_con<<m_connection->getDesc()
|
LOG(dout_con << m_connection->getDesc()
|
||||||
<<" processing queued reliable command "<<std::endl);
|
<< " processing queued reliable command " << std::endl);
|
||||||
if (!processReliableSendCommand(c,max_packet_size)) {
|
|
||||||
LOG(dout_con<<m_connection->getDesc()
|
// Packet is processed, remove it from queue
|
||||||
|
if (processReliableSendCommand(c,max_packet_size)) {
|
||||||
|
channels[i].queued_commands.pop_front();
|
||||||
|
} else {
|
||||||
|
LOG(dout_con << m_connection->getDesc()
|
||||||
<< " Failed to queue packets for peer_id: " << c.peer_id
|
<< " Failed to queue packets for peer_id: " << c.peer_id
|
||||||
<< ", delaying sending of " << c.data.getSize()
|
<< ", delaying sending of " << c.data.getSize()
|
||||||
<< " bytes" << std::endl);
|
<< " bytes" << std::endl);
|
||||||
channels[i].queued_commands.push_front(c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ItemNotFoundException &e) {
|
catch (ItemNotFoundException &e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user