From 4d1d5eb0c6fb34f8bfa38bda4123eb425757ace4 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Tue, 12 Jun 2007 18:47:36 +0000 Subject: * ignored data recieved from closed sockets * removed some warnings --- .../OpenSim.RegionServer/Client/ClientView.Grid.cs | 2 +- .../Simulator/ParcelManager.cs | 4 ++-- OpenSim/OpenSim.RegionServer/Simulator/World.cs | 2 +- OpenSim/OpenSim.RegionServer/UDPServer.cs | 25 ++++++++++++++++++++-- 4 files changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim/OpenSim.RegionServer') diff --git a/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs b/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs index 514435a..0bccbc2 100644 --- a/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs +++ b/OpenSim/OpenSim.RegionServer/Client/ClientView.Grid.cs @@ -98,7 +98,7 @@ namespace OpenSim.RegionServer.Client enablesimpacket.SimulatorInfo.Port = neighbourPort; enablePackets.Add(enablesimpacket); } - catch (Exception e) + catch { MainConsole.Instance.Notice("Could not connect to neighbour " + neighbour["sim_ip"] + ":" + neighbour["sim_port"] + ", continuing."); } diff --git a/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs b/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs index 8620e8c..ace0d20 100644 --- a/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs +++ b/OpenSim/OpenSim.RegionServer/Simulator/ParcelManager.cs @@ -237,7 +237,7 @@ namespace OpenSim.RegionServer.Simulator } } } - catch (Exception e) + catch { return false; //Exception. For now, lets skip subdivision } @@ -294,7 +294,7 @@ namespace OpenSim.RegionServer.Simulator startParcel = getParcel(start_x, start_y); endParcel = getParcel(end_x, end_y); } - catch (Exception e) + catch { return false; //Error occured when trying to get the start and end parcels } diff --git a/OpenSim/OpenSim.RegionServer/Simulator/World.cs b/OpenSim/OpenSim.RegionServer/Simulator/World.cs index 765c74e..ac64c79 100644 --- a/OpenSim/OpenSim.RegionServer/Simulator/World.cs +++ b/OpenSim/OpenSim.RegionServer/Simulator/World.cs @@ -478,7 +478,7 @@ namespace OpenSim.RegionServer.Simulator this.Terrain.loadFromFileF32(this.m_regInfo.estateSettings.terrainFile); this.Terrain *= this.m_regInfo.estateSettings.terrainMultiplier; } - catch (Exception e) + catch { Console.WriteLine("Unable to load default terrain, procedurally generating instead..."); Terrain.hills(); diff --git a/OpenSim/OpenSim.RegionServer/UDPServer.cs b/OpenSim/OpenSim.RegionServer/UDPServer.cs index 6b3e7b1..f0d3367 100644 --- a/OpenSim/OpenSim.RegionServer/UDPServer.cs +++ b/OpenSim/OpenSim.RegionServer/UDPServer.cs @@ -135,7 +135,28 @@ namespace OpenSim.RegionServer ipeSender = new IPEndPoint(IPAddress.Any, 0); epSender = (EndPoint)ipeSender; Packet packet = null; - int numBytes = Server.EndReceiveFrom(result, ref epSender); + + int numBytes; + + try + { + numBytes = Server.EndReceiveFrom(result, ref epSender); + } + catch (SocketException e) + { + switch( e.SocketErrorCode ) + { + case SocketError.NotConnected: + case SocketError.ConnectionReset: + // At this point, we should clear the client connection altogether. + // The app should hook a disconnect event into the UDPServer. + // But for now, just ignore it. + return; + default: + throw; + } + } + int packetEnd = numBytes - 1; packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); @@ -181,7 +202,7 @@ namespace OpenSim.RegionServer ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); Server.Bind(ServerIncoming); - + m_console.Notice("UDPServer.cs:ServerListener() - UDP socket bound, getting ready to listen"); ipeSender = new IPEndPoint(IPAddress.Any, 0); -- cgit v1.1