aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
authorMelanie2011-12-08 01:08:40 +0100
committerMelanie2011-12-08 01:08:40 +0100
commitb45923983381d57e8befbdfb1953ebc349ff7d8e (patch)
tree3199201c3b3f13020e94d7958542118f2bc7bebc /OpenSim/Region/ClientStack
parentFix intersim object give messages (diff)
downloadopensim-SC_OLD-b45923983381d57e8befbdfb1953ebc349ff7d8e.zip
opensim-SC_OLD-b45923983381d57e8befbdfb1953ebc349ff7d8e.tar.gz
opensim-SC_OLD-b45923983381d57e8befbdfb1953ebc349ff7d8e.tar.bz2
opensim-SC_OLD-b45923983381d57e8befbdfb1953ebc349ff7d8e.tar.xz
Recover from an internal mess-up in the outgoing packet queues by creating
a new queue object.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs55
1 files changed, 36 insertions, 19 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
index c951071..ae72175 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs
@@ -498,7 +498,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
498 { 498 {
499 if (m_deliverPackets == false) return false; 499 if (m_deliverPackets == false) return false;
500 500
501 OutgoingPacket packet; 501 OutgoingPacket packet = null;
502 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue; 502 OpenSim.Framework.LocklessQueue<OutgoingPacket> queue;
503 TokenBucket bucket; 503 TokenBucket bucket;
504 bool packetSent = false; 504 bool packetSent = false;
@@ -530,32 +530,49 @@ namespace OpenSim.Region.ClientStack.LindenUDP
530 // No dequeued packet waiting to be sent, try to pull one off 530 // No dequeued packet waiting to be sent, try to pull one off
531 // this queue 531 // this queue
532 queue = m_packetOutboxes[i]; 532 queue = m_packetOutboxes[i];
533 if (queue != null && queue.Dequeue(out packet)) 533 if (queue != null)
534 { 534 {
535 // A packet was pulled off the queue. See if we have 535 bool success = false;
536 // enough tokens in the bucket to send it out 536 try
537 if (bucket.RemoveTokens(packet.Buffer.DataLength))
538 { 537 {
539 // Send the packet 538 success = queue.Dequeue(out packet);
540 m_udpServer.SendPacketFinal(packet);
541 packetSent = true;
542 } 539 }
543 else 540 catch
544 { 541 {
545 // Save the dequeued packet for the next iteration 542 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
546 m_nextPackets[i] = packet;
547 } 543 }
548 544 if (success)
549 // If the queue is empty after this dequeue, fire the queue 545 {
550 // empty callback now so it has a chance to fill before we 546 // A packet was pulled off the queue. See if we have
551 // get back here 547 // enough tokens in the bucket to send it out
552 if (queue.Count == 0) 548 if (bucket.RemoveTokens(packet.Buffer.DataLength))
549 {
550 // Send the packet
551 m_udpServer.SendPacketFinal(packet);
552 packetSent = true;
553 }
554 else
555 {
556 // Save the dequeued packet for the next iteration
557 m_nextPackets[i] = packet;
558 }
559
560 // If the queue is empty after this dequeue, fire the queue
561 // empty callback now so it has a chance to fill before we
562 // get back here
563 if (queue.Count == 0)
564 emptyCategories |= CategoryToFlag(i);
565 }
566 else
567 {
568 // No packets in this queue. Fire the queue empty callback
569 // if it has not been called recently
553 emptyCategories |= CategoryToFlag(i); 570 emptyCategories |= CategoryToFlag(i);
571 }
554 } 572 }
555 else 573 else
556 { 574 {
557 // No packets in this queue. Fire the queue empty callback 575 m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
558 // if it has not been called recently
559 emptyCategories |= CategoryToFlag(i); 576 emptyCategories |= CategoryToFlag(i);
560 } 577 }
561 } 578 }
@@ -713,4 +730,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
713 } 730 }
714 } 731 }
715 } 732 }
716} \ No newline at end of file 733}