aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/BlockingQueue.cs
diff options
context:
space:
mode:
authorMelanie Thielker2008-07-22 17:58:42 +0000
committerMelanie Thielker2008-07-22 17:58:42 +0000
commitf112cebde2c1bc06108839acac82bc8addd7c506 (patch)
tree7f1e7fabf2fec74171d5982f09d847b47e20d7ca /OpenSim/Framework/BlockingQueue.cs
parent* refactor: move new inventory service call by user server to OGS1 with all t... (diff)
downloadopensim-SC-f112cebde2c1bc06108839acac82bc8addd7c506.zip
opensim-SC-f112cebde2c1bc06108839acac82bc8addd7c506.tar.gz
opensim-SC-f112cebde2c1bc06108839acac82bc8addd7c506.tar.bz2
opensim-SC-f112cebde2c1bc06108839acac82bc8addd7c506.tar.xz
Refactor the packet scheduling out of ClientView. Add intelligent
resending, timeouts, packet discarding. Add notification event for packet discarding. Add priority scheduling for packet queues. Add outgoing duplicate detection facility. Correct packet sequencing. Make provisions for automatic server side throttle adjustments (comes in next installment)
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/BlockingQueue.cs20
1 files changed, 17 insertions, 3 deletions
diff --git a/OpenSim/Framework/BlockingQueue.cs b/OpenSim/Framework/BlockingQueue.cs
index 345b361..5b7e911 100644
--- a/OpenSim/Framework/BlockingQueue.cs
+++ b/OpenSim/Framework/BlockingQueue.cs
@@ -32,9 +32,19 @@ namespace OpenSim.Framework
32{ 32{
33 public class BlockingQueue<T> 33 public class BlockingQueue<T>
34 { 34 {
35 private readonly Queue<T> m_pqueue = new Queue<T>();
35 private readonly Queue<T> m_queue = new Queue<T>(); 36 private readonly Queue<T> m_queue = new Queue<T>();
36 private readonly object m_queueSync = new object(); 37 private readonly object m_queueSync = new object();
37 38
39 public void PriorityEnqueue(T value)
40 {
41 lock (m_queueSync)
42 {
43 m_pqueue.Enqueue(value);
44 Monitor.Pulse(m_queueSync);
45 }
46 }
47
38 public void Enqueue(T value) 48 public void Enqueue(T value)
39 { 49 {
40 lock (m_queueSync) 50 lock (m_queueSync)
@@ -48,11 +58,13 @@ namespace OpenSim.Framework
48 { 58 {
49 lock (m_queueSync) 59 lock (m_queueSync)
50 { 60 {
51 if (m_queue.Count < 1) 61 if (m_queue.Count < 1 && m_pqueue.Count < 1)
52 { 62 {
53 Monitor.Wait(m_queueSync); 63 Monitor.Wait(m_queueSync);
54 } 64 }
55 65
66 if(m_pqueue.Count > 0)
67 return m_pqueue.Dequeue();
56 return m_queue.Dequeue(); 68 return m_queue.Dequeue();
57 } 69 }
58 } 70 }
@@ -61,6 +73,8 @@ namespace OpenSim.Framework
61 { 73 {
62 lock (m_queueSync) 74 lock (m_queueSync)
63 { 75 {
76 if(m_pqueue.Contains(item))
77 return true;
64 return m_queue.Contains(item); 78 return m_queue.Contains(item);
65 } 79 }
66 } 80 }
@@ -69,7 +83,7 @@ namespace OpenSim.Framework
69 { 83 {
70 lock (m_queueSync) 84 lock (m_queueSync)
71 { 85 {
72 return m_queue.Count; 86 return m_queue.Count+m_pqueue.Count;
73 } 87 }
74 } 88 }
75 89
@@ -81,4 +95,4 @@ namespace OpenSim.Framework
81 } 95 }
82 } 96 }
83 } 97 }
84} \ No newline at end of file 98}