Skip to content

Commit ab77bf9

Browse files
committedMar 31, 2015
RunCommandQueues: little optimization
remove command from queue on success, else do nothing, instead of remove command from queue and push it front on success
1 parent 7c12172 commit ab77bf9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed
 

Diff for: ‎src/network/connection.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -1190,15 +1190,18 @@ void UDPPeer::RunCommandQueues(
11901190
(commands_processed < maxcommands)) {
11911191
try {
11921192
ConnectionCommand c = channels[i].queued_commands.front();
1193-
channels[i].queued_commands.pop_front();
1194-
LOG(dout_con<<m_connection->getDesc()
1195-
<<" processing queued reliable command "<<std::endl);
1196-
if (!processReliableSendCommand(c,max_packet_size)) {
1197-
LOG(dout_con<<m_connection->getDesc()
1193+
1194+
LOG(dout_con << m_connection->getDesc()
1195+
<< " processing queued reliable command " << std::endl);
1196+
1197+
// Packet is processed, remove it from queue
1198+
if (processReliableSendCommand(c,max_packet_size)) {
1199+
channels[i].queued_commands.pop_front();
1200+
} else {
1201+
LOG(dout_con << m_connection->getDesc()
11981202
<< " Failed to queue packets for peer_id: " << c.peer_id
11991203
<< ", delaying sending of " << c.data.getSize()
12001204
<< " bytes" << std::endl);
1201-
channels[i].queued_commands.push_front(c);
12021205
}
12031206
}
12041207
catch (ItemNotFoundException &e) {

0 commit comments

Comments
 (0)
Please sign in to comment.