From e946b40fddf5699955a4dd738fcbc15fcfa3fd6b Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 14 Sep 2008 01:49:47 +0000 Subject: [PATCH] * Minor fixes and cleanups around code being used for Rex Module work. --- .../ClientStack/IClientNetworkServer.cs | 3 +- .../ClientStack/LindenUDP/LLUDPServer.cs | 33 +++++++++---------- .../InterGrid/OpenGridProtocolModule.cs | 8 ----- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/ClientStack/IClientNetworkServer.cs b/OpenSim/Region/ClientStack/IClientNetworkServer.cs index 1743fd65c8..817e8aff9a 100644 --- a/OpenSim/Region/ClientStack/IClientNetworkServer.cs +++ b/OpenSim/Region/ClientStack/IClientNetworkServer.cs @@ -29,14 +29,13 @@ using System.Net; using System.Net.Sockets; using OpenSim.Framework; using OpenSim.Region.Environment.Scenes; -using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; namespace OpenSim.Region.ClientStack { public interface IClientNetworkServer { - void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass); + void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass); Socket Server { get; } bool HandlesRegion(Location x); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 52a74e73b6..5c3626d05c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -35,7 +35,6 @@ using OpenMetaverse.Packets; using log4net; using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; -using OpenSim.Region.ClientStack.LindenUDP; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.ClientStack.LindenUDP @@ -141,15 +140,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// /// /// - /// + /// /// /// /// public void Initialise( - IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager) + IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager) { - this.proxyPortOffset = proxyPortOffset; - listenPort = (uint) (port + proxyPortOffset); + proxyPortOffset = proxyPortOffsetParm; + listenPort = (uint) (port + proxyPortOffsetParm); listenIP = _listenIP; Allow_Alternate_Port = allow_alternate_port; m_assetCache = assetCache; @@ -159,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Return new port // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. // So the option allow_alternate_ports="true" was added to default.xml - port = (uint)(listenPort - proxyPortOffset); + port = (uint)(listenPort - proxyPortOffsetParm); } protected virtual void CreatePacketServer() @@ -175,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected virtual void OnReceivedData(IAsyncResult result) { ipeSender = new IPEndPoint(listenIP, 0); - epSender = (EndPoint) ipeSender; + epSender = ipeSender; Packet packet = null; int numBytes = 1; @@ -218,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // int z; for (z = numBytes ; z < RecvBuffer.Length ; z++) - RecvBuffer[z] = (byte)0; + RecvBuffer[z] = 0; epProxy = epSender; if (proxyPortOffset != 0) @@ -242,7 +241,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception e) { - m_log.Debug("[CLIENT]: " + e.ToString()); + m_log.Debug("[CLIENT]: " + e); } } @@ -255,7 +254,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // do we already have a circuit for this endpoint uint circuit; - bool ret = false; + bool ret; lock (clientCircuits) { ret = clientCircuits.TryGetValue(epSender, out circuit); @@ -312,7 +311,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } catch (Exception a) { - m_log.Info("[UDPSERVER]: " + a.ToString()); + m_log.Info("[UDPSERVER]: " + a); } try @@ -413,8 +412,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_log.Info("[UDPSERVER]: UDP socket bound, getting ready to listen"); ipeSender = new IPEndPoint(listenIP, 0); - epSender = (EndPoint)ipeSender; - ReceivedData = new AsyncCallback(OnReceivedData); + epSender = ipeSender; + ReceivedData = OnReceivedData; m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); m_log.Info("[UDPSERVER]: Listening on port " + newPort); @@ -429,7 +428,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP //EndPoint packetSender) { // find the endpoint for this circuit - EndPoint sendto = null; + EndPoint sendto; try { sendto = (EndPoint)clientCircuits_reverse[circuitcode]; } catch { @@ -457,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP public virtual void RemoveClientCircuit(uint circuitcode) { - EndPoint sendto = null; + EndPoint sendto; if (clientCircuits_reverse.Contains(circuitcode)) { sendto = (EndPoint)clientCircuits_reverse[circuitcode]; @@ -497,14 +496,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (!clientCircuits.ContainsKey(userEP)) clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); else - m_log.Error("[CLIENT]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); + m_log.Error("[CLIENT]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code + ". NOT adding."); } // This data structure is synchronized, so we don't need the lock if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP); else - m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); + m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding."); lock (proxyCircuits) { diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index 2604b3ff89..6e37b95a48 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -26,15 +26,12 @@ */ using System; -using System.Collections; using System.Collections.Generic; using System.IO; using System.Net; using System.Net.Security; using System.Security.Cryptography.X509Certificates; -using System.Net.Sockets; using System.Reflection; -using System.Text.RegularExpressions; using System.Threading; using OpenMetaverse; @@ -42,12 +39,7 @@ using OpenMetaverse.StructuredData; using log4net; using Nini.Config; -using Nwc.XmlRpc; - using OpenSim.Framework; -using OpenSim.Framework.Communications.Cache; -using OpenSim.Framework.Communications.Capabilities; -using OpenSim.Framework.Statistics; using OpenSim.Framework.Servers; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes;