diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 0e9f1b7..37fd252 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -223,6 +223,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
223 | /// <summary>Flag to signal when clients should send pings</summary> | 223 | /// <summary>Flag to signal when clients should send pings</summary> |
224 | protected bool m_sendPing; | 224 | protected bool m_sendPing; |
225 | 225 | ||
226 | /// <summary> | ||
227 | /// Event used to signal when queued packets are available for sending. | ||
228 | /// </summary> | ||
229 | /// <remarks> | ||
230 | /// This allows the outbound loop to only operate when there is data to send rather than continuously polling. | ||
231 | /// Some data is sent immediately and not queued. That data would not trigger this event. | ||
232 | /// </remarks> | ||
233 | private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); | ||
234 | |||
226 | private Pool<IncomingPacket> m_incomingPacketPool; | 235 | private Pool<IncomingPacket> m_incomingPacketPool; |
227 | 236 | ||
228 | /// <summary> | 237 | /// <summary> |
@@ -881,11 +890,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
881 | } | 890 | } |
882 | 891 | ||
883 | PacketPool.Instance.ReturnPacket(packet); | 892 | PacketPool.Instance.ReturnPacket(packet); |
893 | |||
884 | m_dataPresentEvent.Set(); | 894 | m_dataPresentEvent.Set(); |
885 | } | 895 | } |
886 | 896 | ||
887 | private AutoResetEvent m_dataPresentEvent = new AutoResetEvent(false); | ||
888 | |||
889 | /// <summary> | 897 | /// <summary> |
890 | /// Start the process of sending a packet to the client. | 898 | /// Start the process of sending a packet to the client. |
891 | /// </summary> | 899 | /// </summary> |
@@ -1817,6 +1825,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1817 | // token bucket could get more tokens | 1825 | // token bucket could get more tokens |
1818 | //if (!m_packetSent) | 1826 | //if (!m_packetSent) |
1819 | // Thread.Sleep((int)TickCountResolution); | 1827 | // Thread.Sleep((int)TickCountResolution); |
1828 | // | ||
1829 | // Instead, now wait for data present to be explicitly signalled. Evidence so far is that with | ||
1830 | // modern mono it reduces CPU base load since there is no more continuous polling. | ||
1820 | m_dataPresentEvent.WaitOne(100); | 1831 | m_dataPresentEvent.WaitOne(100); |
1821 | 1832 | ||
1822 | Watchdog.UpdateThread(); | 1833 | Watchdog.UpdateThread(); |