diff options
author | Adam Frisby | 2008-09-14 01:49:47 +0000 |
---|---|---|
committer | Adam Frisby | 2008-09-14 01:49:47 +0000 |
commit | e946b40fddf5699955a4dd738fcbc15fcfa3fd6b (patch) | |
tree | a70d453f93fdbbf5bab0abd5b8428d7deef48e32 /OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |
parent | Mantis#2183. Thank you kindly, Ewe Loon for a patch that addresses: (diff) | |
download | opensim-SC-e946b40fddf5699955a4dd738fcbc15fcfa3fd6b.zip opensim-SC-e946b40fddf5699955a4dd738fcbc15fcfa3fd6b.tar.gz opensim-SC-e946b40fddf5699955a4dd738fcbc15fcfa3fd6b.tar.bz2 opensim-SC-e946b40fddf5699955a4dd738fcbc15fcfa3fd6b.tar.xz |
* Minor fixes and cleanups around code being used for Rex Module work.
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 52a74e7..5c3626d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -35,7 +35,6 @@ using OpenMetaverse.Packets; | |||
35 | using log4net; | 35 | using log4net; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Communications.Cache; | 37 | using OpenSim.Framework.Communications.Cache; |
38 | using OpenSim.Region.ClientStack.LindenUDP; | ||
39 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
40 | 39 | ||
41 | namespace OpenSim.Region.ClientStack.LindenUDP | 40 | namespace OpenSim.Region.ClientStack.LindenUDP |
@@ -141,15 +140,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
141 | /// </summary> | 140 | /// </summary> |
142 | /// <param name="_listenIP"></param> | 141 | /// <param name="_listenIP"></param> |
143 | /// <param name="port"></param> | 142 | /// <param name="port"></param> |
144 | /// <param name="proxyPortOffset"></param> | 143 | /// <param name="proxyPortOffsetParm"></param> |
145 | /// <param name="allow_alternate_port"></param> | 144 | /// <param name="allow_alternate_port"></param> |
146 | /// <param name="assetCache"></param> | 145 | /// <param name="assetCache"></param> |
147 | /// <param name="circuitManager"></param> | 146 | /// <param name="circuitManager"></param> |
148 | public void Initialise( | 147 | public void Initialise( |
149 | IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager) | 148 | IPAddress _listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager) |
150 | { | 149 | { |
151 | this.proxyPortOffset = proxyPortOffset; | 150 | proxyPortOffset = proxyPortOffsetParm; |
152 | listenPort = (uint) (port + proxyPortOffset); | 151 | listenPort = (uint) (port + proxyPortOffsetParm); |
153 | listenIP = _listenIP; | 152 | listenIP = _listenIP; |
154 | Allow_Alternate_Port = allow_alternate_port; | 153 | Allow_Alternate_Port = allow_alternate_port; |
155 | m_assetCache = assetCache; | 154 | m_assetCache = assetCache; |
@@ -159,7 +158,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
159 | // Return new port | 158 | // Return new port |
160 | // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. | 159 | // This because in Grid mode it is not really important what port the region listens to as long as it is correctly registered. |
161 | // So the option allow_alternate_ports="true" was added to default.xml | 160 | // So the option allow_alternate_ports="true" was added to default.xml |
162 | port = (uint)(listenPort - proxyPortOffset); | 161 | port = (uint)(listenPort - proxyPortOffsetParm); |
163 | } | 162 | } |
164 | 163 | ||
165 | protected virtual void CreatePacketServer() | 164 | protected virtual void CreatePacketServer() |
@@ -175,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
175 | protected virtual void OnReceivedData(IAsyncResult result) | 174 | protected virtual void OnReceivedData(IAsyncResult result) |
176 | { | 175 | { |
177 | ipeSender = new IPEndPoint(listenIP, 0); | 176 | ipeSender = new IPEndPoint(listenIP, 0); |
178 | epSender = (EndPoint) ipeSender; | 177 | epSender = ipeSender; |
179 | Packet packet = null; | 178 | Packet packet = null; |
180 | 179 | ||
181 | int numBytes = 1; | 180 | int numBytes = 1; |
@@ -218,7 +217,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
218 | // | 217 | // |
219 | int z; | 218 | int z; |
220 | for (z = numBytes ; z < RecvBuffer.Length ; z++) | 219 | for (z = numBytes ; z < RecvBuffer.Length ; z++) |
221 | RecvBuffer[z] = (byte)0; | 220 | RecvBuffer[z] = 0; |
222 | 221 | ||
223 | epProxy = epSender; | 222 | epProxy = epSender; |
224 | if (proxyPortOffset != 0) | 223 | if (proxyPortOffset != 0) |
@@ -242,7 +241,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
242 | } | 241 | } |
243 | catch (Exception e) | 242 | catch (Exception e) |
244 | { | 243 | { |
245 | m_log.Debug("[CLIENT]: " + e.ToString()); | 244 | m_log.Debug("[CLIENT]: " + e); |
246 | } | 245 | } |
247 | } | 246 | } |
248 | 247 | ||
@@ -255,7 +254,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
255 | // do we already have a circuit for this endpoint | 254 | // do we already have a circuit for this endpoint |
256 | uint circuit; | 255 | uint circuit; |
257 | 256 | ||
258 | bool ret = false; | 257 | bool ret; |
259 | lock (clientCircuits) | 258 | lock (clientCircuits) |
260 | { | 259 | { |
261 | ret = clientCircuits.TryGetValue(epSender, out circuit); | 260 | ret = clientCircuits.TryGetValue(epSender, out circuit); |
@@ -312,7 +311,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
312 | } | 311 | } |
313 | catch (Exception a) | 312 | catch (Exception a) |
314 | { | 313 | { |
315 | m_log.Info("[UDPSERVER]: " + a.ToString()); | 314 | m_log.Info("[UDPSERVER]: " + a); |
316 | } | 315 | } |
317 | 316 | ||
318 | try | 317 | try |
@@ -413,8 +412,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
413 | m_log.Info("[UDPSERVER]: UDP socket bound, getting ready to listen"); | 412 | m_log.Info("[UDPSERVER]: UDP socket bound, getting ready to listen"); |
414 | 413 | ||
415 | ipeSender = new IPEndPoint(listenIP, 0); | 414 | ipeSender = new IPEndPoint(listenIP, 0); |
416 | epSender = (EndPoint)ipeSender; | 415 | epSender = ipeSender; |
417 | ReceivedData = new AsyncCallback(OnReceivedData); | 416 | ReceivedData = OnReceivedData; |
418 | m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 417 | m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
419 | 418 | ||
420 | m_log.Info("[UDPSERVER]: Listening on port " + newPort); | 419 | m_log.Info("[UDPSERVER]: Listening on port " + newPort); |
@@ -429,7 +428,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
429 | //EndPoint packetSender) | 428 | //EndPoint packetSender) |
430 | { | 429 | { |
431 | // find the endpoint for this circuit | 430 | // find the endpoint for this circuit |
432 | EndPoint sendto = null; | 431 | EndPoint sendto; |
433 | try { | 432 | try { |
434 | sendto = (EndPoint)clientCircuits_reverse[circuitcode]; | 433 | sendto = (EndPoint)clientCircuits_reverse[circuitcode]; |
435 | } catch { | 434 | } catch { |
@@ -457,7 +456,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
457 | 456 | ||
458 | public virtual void RemoveClientCircuit(uint circuitcode) | 457 | public virtual void RemoveClientCircuit(uint circuitcode) |
459 | { | 458 | { |
460 | EndPoint sendto = null; | 459 | EndPoint sendto; |
461 | if (clientCircuits_reverse.Contains(circuitcode)) | 460 | if (clientCircuits_reverse.Contains(circuitcode)) |
462 | { | 461 | { |
463 | sendto = (EndPoint)clientCircuits_reverse[circuitcode]; | 462 | sendto = (EndPoint)clientCircuits_reverse[circuitcode]; |
@@ -497,14 +496,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
497 | if (!clientCircuits.ContainsKey(userEP)) | 496 | if (!clientCircuits.ContainsKey(userEP)) |
498 | clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); | 497 | clientCircuits.Add(userEP, useCircuit.CircuitCode.Code); |
499 | else | 498 | else |
500 | m_log.Error("[CLIENT]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | 499 | m_log.Error("[CLIENT]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code + ". NOT adding."); |
501 | } | 500 | } |
502 | 501 | ||
503 | // This data structure is synchronized, so we don't need the lock | 502 | // This data structure is synchronized, so we don't need the lock |
504 | if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) | 503 | if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code)) |
505 | clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP); | 504 | clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP); |
506 | else | 505 | else |
507 | m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | 506 | m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding."); |
508 | 507 | ||
509 | lock (proxyCircuits) | 508 | lock (proxyCircuits) |
510 | { | 509 | { |