diff options
author | John Hurliman | 2009-10-22 12:33:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-22 12:33:23 -0700 |
commit | b2ed348aa2746fbf034b713d006e40366c479d5a (patch) | |
tree | 26c114e88f54e64e1fdf17dcc7de1e54165db2bc /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.zip opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.gz opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.bz2 opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.xz |
Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index a9f4b2c..734471e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -187,14 +187,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
187 | 187 | ||
188 | base.Start(m_recvBufferSize, m_asyncPacketHandling); | 188 | base.Start(m_recvBufferSize, m_asyncPacketHandling); |
189 | 189 | ||
190 | // Start the incoming packet processing thread | 190 | // Start the packet processing threads |
191 | Thread incomingThread = new Thread(IncomingPacketHandler); | 191 | Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); |
192 | incomingThread.Name = "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")"; | 192 | Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); |
193 | incomingThread.Start(); | ||
194 | |||
195 | Thread outgoingThread = new Thread(OutgoingPacketHandler); | ||
196 | outgoingThread.Name = "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")"; | ||
197 | outgoingThread.Start(); | ||
198 | } | 193 | } |
199 | 194 | ||
200 | public new void Stop() | 195 | public new void Stop() |
@@ -775,11 +770,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
775 | { | 770 | { |
776 | m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex); | 771 | m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex); |
777 | } | 772 | } |
773 | |||
774 | Watchdog.UpdateThread(); | ||
778 | } | 775 | } |
779 | 776 | ||
780 | if (packetInbox.Count > 0) | 777 | if (packetInbox.Count > 0) |
781 | m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets"); | 778 | m_log.Warn("[LLUDPSERVER]: IncomingPacketHandler is shutting down, dropping " + packetInbox.Count + " packets"); |
782 | packetInbox.Clear(); | 779 | packetInbox.Clear(); |
780 | |||
781 | Watchdog.RemoveThread(); | ||
783 | } | 782 | } |
784 | 783 | ||
785 | private void OutgoingPacketHandler() | 784 | private void OutgoingPacketHandler() |
@@ -842,12 +841,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
842 | // token bucket could get more tokens | 841 | // token bucket could get more tokens |
843 | if (!m_packetSent) | 842 | if (!m_packetSent) |
844 | Thread.Sleep((int)TickCountResolution); | 843 | Thread.Sleep((int)TickCountResolution); |
844 | |||
845 | Watchdog.UpdateThread(); | ||
845 | } | 846 | } |
846 | catch (Exception ex) | 847 | catch (Exception ex) |
847 | { | 848 | { |
848 | m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); | 849 | m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex); |
849 | } | 850 | } |
850 | } | 851 | } |
852 | |||
853 | Watchdog.RemoveThread(); | ||
851 | } | 854 | } |
852 | 855 | ||
853 | private void ClientOutgoingPacketHandler(IClientAPI client) | 856 | private void ClientOutgoingPacketHandler(IClientAPI client) |