diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 113 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 3 |
2 files changed, 113 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 7042c9a..f9ba14c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -110,7 +110,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
110 | /// <summary>Handlers for incoming packets</summary> | 110 | /// <summary>Handlers for incoming packets</summary> |
111 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); | 111 | //PacketEventDictionary packetEvents = new PacketEventDictionary(); |
112 | /// <summary>Incoming packets that are awaiting handling</summary> | 112 | /// <summary>Incoming packets that are awaiting handling</summary> |
113 | private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); | 113 | //private OpenMetaverse.BlockingQueue<IncomingPacket> packetInbox = new OpenMetaverse.BlockingQueue<IncomingPacket>(); |
114 | |||
115 | private DoubleQueue<IncomingPacket> packetInbox = new DoubleQueue<IncomingPacket>(); | ||
116 | |||
114 | /// <summary></summary> | 117 | /// <summary></summary> |
115 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 118 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
116 | /// <summary>Bandwidth throttle for this UDP server</summary> | 119 | /// <summary>Bandwidth throttle for this UDP server</summary> |
@@ -919,7 +922,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
919 | #endregion Ping Check Handling | 922 | #endregion Ping Check Handling |
920 | 923 | ||
921 | // Inbox insertion | 924 | // Inbox insertion |
922 | packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); | 925 | if (packet.Type == PacketType.AgentUpdate || |
926 | packet.Type == PacketType.ChatFromViewer) | ||
927 | packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); | ||
928 | else | ||
929 | packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); | ||
923 | } | 930 | } |
924 | 931 | ||
925 | #region BinaryStats | 932 | #region BinaryStats |
@@ -1519,4 +1526,106 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1519 | } | 1526 | } |
1520 | } | 1527 | } |
1521 | } | 1528 | } |
1529 | |||
1530 | internal class DoubleQueue<T> where T:class | ||
1531 | { | ||
1532 | private Queue<T> m_lowQueue = new Queue<T>(); | ||
1533 | private Queue<T> m_highQueue = new Queue<T>(); | ||
1534 | |||
1535 | private object m_syncRoot = new object(); | ||
1536 | private Semaphore m_s = new Semaphore(0, 1); | ||
1537 | |||
1538 | public DoubleQueue() | ||
1539 | { | ||
1540 | } | ||
1541 | |||
1542 | public virtual int Count | ||
1543 | { | ||
1544 | get { return m_highQueue.Count + m_lowQueue.Count; } | ||
1545 | } | ||
1546 | |||
1547 | public virtual void Enqueue(T data) | ||
1548 | { | ||
1549 | Enqueue(m_lowQueue, data); | ||
1550 | } | ||
1551 | |||
1552 | public virtual void EnqueueLow(T data) | ||
1553 | { | ||
1554 | Enqueue(m_lowQueue, data); | ||
1555 | } | ||
1556 | |||
1557 | public virtual void EnqueueHigh(T data) | ||
1558 | { | ||
1559 | Enqueue(m_highQueue, data); | ||
1560 | } | ||
1561 | |||
1562 | private void Enqueue(Queue<T> q, T data) | ||
1563 | { | ||
1564 | lock (m_syncRoot) | ||
1565 | { | ||
1566 | m_lowQueue.Enqueue(data); | ||
1567 | m_s.WaitOne(0); | ||
1568 | m_s.Release(); | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1572 | public virtual T Dequeue() | ||
1573 | { | ||
1574 | return Dequeue(Timeout.Infinite); | ||
1575 | } | ||
1576 | |||
1577 | public virtual T Dequeue(int tmo) | ||
1578 | { | ||
1579 | return Dequeue(TimeSpan.FromMilliseconds(tmo)); | ||
1580 | } | ||
1581 | |||
1582 | public virtual T Dequeue(TimeSpan wait) | ||
1583 | { | ||
1584 | T res = null; | ||
1585 | |||
1586 | if (!Dequeue(wait, ref res)) | ||
1587 | return null; | ||
1588 | |||
1589 | return res; | ||
1590 | } | ||
1591 | |||
1592 | public bool Dequeue(int timeout, ref T res) | ||
1593 | { | ||
1594 | return Dequeue(TimeSpan.FromMilliseconds(timeout), ref res); | ||
1595 | } | ||
1596 | |||
1597 | public bool Dequeue(TimeSpan wait, ref T res) | ||
1598 | { | ||
1599 | if (!m_s.WaitOne(wait)) | ||
1600 | return false; | ||
1601 | |||
1602 | lock (m_syncRoot) | ||
1603 | { | ||
1604 | if (m_highQueue.Count > 0) | ||
1605 | res = m_highQueue.Dequeue(); | ||
1606 | else | ||
1607 | res = m_lowQueue.Dequeue(); | ||
1608 | |||
1609 | if (m_highQueue.Count == 0 || m_lowQueue.Count == 0) | ||
1610 | return true; | ||
1611 | |||
1612 | m_s.Release(); | ||
1613 | |||
1614 | return true; | ||
1615 | } | ||
1616 | } | ||
1617 | |||
1618 | public virtual void Clear() | ||
1619 | { | ||
1620 | |||
1621 | lock (m_syncRoot) | ||
1622 | { | ||
1623 | // Make sure sem count is 0 | ||
1624 | m_s.WaitOne(0); | ||
1625 | |||
1626 | m_lowQueue.Clear(); | ||
1627 | m_highQueue.Clear(); | ||
1628 | } | ||
1629 | } | ||
1630 | } | ||
1522 | } | 1631 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 834d27b..5052683 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3033,7 +3033,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3033 | /// <param name="objectGroup"></param> | 3033 | /// <param name="objectGroup"></param> |
3034 | public virtual void DetachFromBackup() | 3034 | public virtual void DetachFromBackup() |
3035 | { | 3035 | { |
3036 | m_scene.SceneGraph.FireDetachFromBackup(this); | 3036 | if (m_scene != null) |
3037 | m_scene.SceneGraph.FireDetachFromBackup(this); | ||
3037 | if (m_isBackedUp && Scene != null) | 3038 | if (m_isBackedUp && Scene != null) |
3038 | m_scene.EventManager.OnBackup -= ProcessBackup; | 3039 | m_scene.EventManager.OnBackup -= ProcessBackup; |
3039 | 3040 | ||