aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-20 12:43:09 -0700
committerJohn Hurliman2009-10-20 12:43:09 -0700
commitd1ab11dc2a60ddab0cca214a1c165e386dbb5d43 (patch)
tree0602dac049fb5760358f17b4f75e3e874f99e0f6 /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
parentFixing position/rotation/collisionplane in ObjectUpdate packets for avatars (diff)
downloadopensim-SC-d1ab11dc2a60ddab0cca214a1c165e386dbb5d43.zip
opensim-SC-d1ab11dc2a60ddab0cca214a1c165e386dbb5d43.tar.gz
opensim-SC-d1ab11dc2a60ddab0cca214a1c165e386dbb5d43.tar.bz2
opensim-SC-d1ab11dc2a60ddab0cca214a1c165e386dbb5d43.tar.xz
Added try/catches in the outgoing packet handler to match the one in the incoming packet handler
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs104
1 files changed, 59 insertions, 45 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index a6ead5e..3881bdb 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -776,61 +776,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
776 776
777 while (base.IsRunning) 777 while (base.IsRunning)
778 { 778 {
779 bool resendUnacked = false; 779 try
780 bool sendAcks = false;
781 bool sendPings = false;
782 bool packetSent = false;
783
784 elapsedMS += Environment.TickCount - now;
785
786 // Check for pending outgoing resends every 100ms
787 if (elapsedMS >= 100)
788 {
789 resendUnacked = true;
790 elapsedMS -= 100;
791 ++elapsed100MS;
792 }
793 // Check for pending outgoing ACKs every 500ms
794 if (elapsed100MS >= 5)
795 {
796 sendAcks = true;
797 elapsed100MS = 0;
798 ++elapsed500MS;
799 }
800 // Send pings to clients every 5000ms
801 if (elapsed500MS >= 10)
802 { 780 {
803 sendPings = true; 781 bool resendUnacked = false;
804 elapsed500MS = 0; 782 bool sendAcks = false;
805 } 783 bool sendPings = false;
784 bool packetSent = false;
806 785
807 m_scene.ClientManager.ForEachSync( 786 elapsedMS += Environment.TickCount - now;
808 delegate(IClientAPI client) 787
788 // Check for pending outgoing resends every 100ms
789 if (elapsedMS >= 100)
809 { 790 {
810 if (client is LLClientView) 791 resendUnacked = true;
811 { 792 elapsedMS -= 100;
812 LLUDPClient udpClient = ((LLClientView)client).UDPClient; 793 ++elapsed100MS;
794 }
795 // Check for pending outgoing ACKs every 500ms
796 if (elapsed100MS >= 5)
797 {
798 sendAcks = true;
799 elapsed100MS = 0;
800 ++elapsed500MS;
801 }
802 // Send pings to clients every 5000ms
803 if (elapsed500MS >= 10)
804 {
805 sendPings = true;
806 elapsed500MS = 0;
807 }
813 808
814 if (udpClient.IsConnected) 809 m_scene.ClientManager.ForEachSync(
810 delegate(IClientAPI client)
811 {
812 try
815 { 813 {
816 if (udpClient.DequeueOutgoing()) 814 if (client is LLClientView)
817 packetSent = true;
818 if (resendUnacked)
819 ResendUnacked(udpClient);
820 if (sendAcks)
821 { 815 {
822 SendAcks(udpClient); 816 LLUDPClient udpClient = ((LLClientView)client).UDPClient;
823 udpClient.SendPacketStats(); 817
818 if (udpClient.IsConnected)
819 {
820 if (udpClient.DequeueOutgoing())
821 packetSent = true;
822 if (resendUnacked)
823 ResendUnacked(udpClient);
824 if (sendAcks)
825 {
826 SendAcks(udpClient);
827 udpClient.SendPacketStats();
828 }
829 if (sendPings)
830 SendPing(udpClient);
831 }
824 } 832 }
825 if (sendPings) 833 }
826 SendPing(udpClient); 834 catch (Exception ex)
835 {
836 m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler iteration for " + client.Name + " threw an exception: " + ex.Message, ex);
827 } 837 }
828 } 838 }
829 } 839 );
830 );
831 840
832 if (!packetSent) 841 if (!packetSent)
833 Thread.Sleep(20); 842 Thread.Sleep(20);
843 }
844 catch (Exception ex)
845 {
846 m_log.Error("[LLUDPSERVER]: OutgoingPacketHandler loop threw an exception: " + ex.Message, ex);
847 }
834 } 848 }
835 } 849 }
836 850