From 81a00dd68f38d0f76abe85fed3c08f7d5150eb65 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Mon, 18 Feb 2008 07:22:10 +0000 Subject: [PATCH] * Thanks to Ahzz, more verbose error messages on the console and possibly a fix to the b*stard Sakai issue. --- OpenSim/Region/ClientStack/UDPServer.cs | 83 +++++++++++-------- .../Environment/Scenes/ScenePresence.cs | 9 +- 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/ClientStack/UDPServer.cs b/OpenSim/Region/ClientStack/UDPServer.cs index 73f2ac1bc4..7b32490803 100644 --- a/OpenSim/Region/ClientStack/UDPServer.cs +++ b/OpenSim/Region/ClientStack/UDPServer.cs @@ -224,39 +224,6 @@ namespace OpenSim.Region.ClientStack m_log.Debug("[UDPSERVER]: " + e.ToString()); } - if (packet != null) - { - // do we already have a circuit for this endpoint - uint circuit; - if (clientCircuits.TryGetValue(epSender, out circuit)) - { - //if so then send packet to the packetserver - //m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!"); - m_packetServer.InPacket(circuit, packet); - } - else if (packet.Type == PacketType.UseCircuitCode) - { - // new client - m_log.Debug("[UDPSERVER]: Adding New Client"); - try - { - AddNewClient(packet); - } - catch (Exception e3) - { - m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString()); - Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, - ReceivedData, null); - } - } - else - { - // invalid client - //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now - //m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString()); - - } - } try { Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); @@ -289,6 +256,56 @@ namespace OpenSim.Region.ClientStack } } + + if (packet != null) + { + try + { + // do we already have a circuit for this endpoint + uint circuit; + + bool ret = false; + lock (clientCircuits) + { + ret = clientCircuits.TryGetValue(epSender, out circuit); + } + if (ret) + { + //if so then send packet to the packetserver + //m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!"); + m_packetServer.InPacket(circuit, packet); + } + else if (packet.Type == PacketType.UseCircuitCode) + { + // new client + m_log.Debug("[UDPSERVER]: Adding New Client"); + AddNewClient(packet); + } + else + { + // invalid client + //CFK: This message seems to have served its usefullness as of 12-15 so I am commenting it out for now + //m_log.Warn("[UDPSERVER]: Got a packet from an invalid client - " + packet.ToString()); + + } + } + catch (Exception ex) + { + m_log.Error("[UDPSERVER]: Exception in processing packet."); + m_log.Debug("[UDPSERVER]: Adding New Client"); + try + { + AddNewClient(packet); + } + catch (Exception e3) + { + m_log.Error("[UDPSERVER]: Adding New Client threw exception " + e3.ToString()); + Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, + ReceivedData, null); + } + } + } + } private void CloseEndPoint(EndPoint sender) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 84ee9c4258..8e5907c8ac 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -750,7 +750,14 @@ namespace OpenSim.Region.Environment.Scenes if ((flags & (uint) DCF) != 0) { DCFlagKeyPressed = true; - agent_control_v3 += Dir_Vectors[i]; + try + { + agent_control_v3 += Dir_Vectors[i]; + } + catch (IndexOutOfRangeException) + { + // Why did I get this? + } if ((m_movementflag & (uint) DCF) == 0) { m_movementflag += (byte) (uint) DCF;