diff options
author | Justin Clarke Casey | 2008-09-07 00:47:08 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-09-07 00:47:08 +0000 |
commit | ea8c18f63d7d8079bc790524bc99e9e067f29737 (patch) | |
tree | fbd44be8c88d2f0147f809d992fd4b96d49c9668 /OpenSim/Region | |
parent | Remove a few of the commented out "NotImplemented" (diff) | |
download | opensim-SC-ea8c18f63d7d8079bc790524bc99e9e067f29737.zip opensim-SC-ea8c18f63d7d8079bc790524bc99e9e067f29737.tar.gz opensim-SC-ea8c18f63d7d8079bc790524bc99e9e067f29737.tar.bz2 opensim-SC-ea8c18f63d7d8079bc790524bc99e9e067f29737.tar.xz |
* minor: just minor doc and tidy up
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 92321b6..ceb99ae 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -40,6 +40,9 @@ using OpenSim.Region.Environment.Scenes; | |||
40 | 40 | ||
41 | namespace OpenSim.Region.ClientStack.LindenUDP | 41 | namespace OpenSim.Region.ClientStack.LindenUDP |
42 | { | 42 | { |
43 | /// <summary> | ||
44 | /// This class handles the initial UDP circuit setup with a client and passes on subsequent packets to the LLPacketServer | ||
45 | /// </summary> | ||
43 | public class LLUDPServer : LLClientStackNetworkHandler, IClientNetworkServer | 46 | public class LLUDPServer : LLClientStackNetworkHandler, IClientNetworkServer |
44 | { | 47 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -55,7 +58,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
55 | protected byte[] RecvBuffer = new byte[4096]; | 58 | protected byte[] RecvBuffer = new byte[4096]; |
56 | protected byte[] ZeroBuffer = new byte[8192]; | 59 | protected byte[] ZeroBuffer = new byte[8192]; |
57 | protected IPEndPoint ipeSender; | 60 | protected IPEndPoint ipeSender; |
61 | |||
62 | /// <value> | ||
63 | /// The endpoint of a sender of a particular packet. The port is continually changed by the various socket receive methods | ||
64 | /// </value> | ||
58 | protected EndPoint epSender; | 65 | protected EndPoint epSender; |
66 | |||
59 | protected EndPoint epProxy; | 67 | protected EndPoint epProxy; |
60 | protected int proxyPortOffset; | 68 | protected int proxyPortOffset; |
61 | protected AsyncCallback ReceivedData; | 69 | protected AsyncCallback ReceivedData; |
@@ -145,6 +153,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
145 | new LLPacketServer(this); | 153 | new LLPacketServer(this); |
146 | } | 154 | } |
147 | 155 | ||
156 | /// <summary> | ||
157 | /// This method is called every time that we receive new UDP data. We pass this data on to the LLPacketServer | ||
158 | /// except in the case that the packet is UseCircuitCode. In this case we set up the circuit code instead. | ||
159 | /// </summary> | ||
160 | /// <param name="result"></param> | ||
148 | protected virtual void OnReceivedData(IAsyncResult result) | 161 | protected virtual void OnReceivedData(IAsyncResult result) |
149 | { | 162 | { |
150 | ipeSender = new IPEndPoint(listenIP, 0); | 163 | ipeSender = new IPEndPoint(listenIP, 0); |
@@ -226,10 +239,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
226 | { | 239 | { |
227 | ret = clientCircuits.TryGetValue(epSender, out circuit); | 240 | ret = clientCircuits.TryGetValue(epSender, out circuit); |
228 | } | 241 | } |
242 | |||
229 | if (ret) | 243 | if (ret) |
230 | { | 244 | { |
231 | //if so then send packet to the packetserver | 245 | //if so then send packet to the packetserver |
232 | //m_log.Warn("[UDPSERVER]: ALREADY HAVE Circuit!"); | 246 | //m_log.DebugFormat("[UDPSERVER]: For endpoint {0} got packet {1}", epSender, packet.Type); |
247 | |||
233 | m_packetServer.InPacket(circuit, packet); | 248 | m_packetServer.InPacket(circuit, packet); |
234 | } | 249 | } |
235 | else if (packet.Type == PacketType.UseCircuitCode) | 250 | else if (packet.Type == PacketType.UseCircuitCode) |
@@ -311,6 +326,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
311 | } | 326 | } |
312 | } | 327 | } |
313 | 328 | ||
329 | /// <summary> | ||
330 | /// Add a new client circuit. | ||
331 | /// </summary> | ||
332 | /// <param name="packet"></param> | ||
314 | protected virtual void AddNewClient(Packet packet) | 333 | protected virtual void AddNewClient(Packet packet) |
315 | { | 334 | { |
316 | //Slave regions don't accept new clients | 335 | //Slave regions don't accept new clients |
@@ -325,7 +344,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
325 | if (!clientCircuits.ContainsKey(epSender)) | 344 | if (!clientCircuits.ContainsKey(epSender)) |
326 | clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); | 345 | clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); |
327 | else | 346 | else |
328 | m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); | 347 | m_log.Error("[UDPSERVER]: clientCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding."); |
329 | } | 348 | } |
330 | 349 | ||
331 | // This doesn't need locking as it's synchronized data | 350 | // This doesn't need locking as it's synchronized data |
@@ -345,13 +364,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
345 | 364 | ||
346 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy); | 365 | PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy); |
347 | } | 366 | } |
367 | |||
348 | PacketPool.Instance.ReturnPacket(packet); | 368 | PacketPool.Instance.ReturnPacket(packet); |
349 | } | 369 | } |
350 | 370 | ||
351 | public void ServerListener() | 371 | public void ServerListener() |
352 | { | 372 | { |
353 | uint newPort = listenPort; | 373 | uint newPort = listenPort; |
354 | m_log.Info("[SERVER]: Opening UDP socket on " + listenIP.ToString() + " " + newPort + "."); | 374 | m_log.Info("[SERVER]: Opening UDP socket on " + listenIP + " " + newPort + "."); |
355 | 375 | ||
356 | ServerIncoming = new IPEndPoint(listenIP, (int)newPort); | 376 | ServerIncoming = new IPEndPoint(listenIP, (int)newPort); |
357 | m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 377 | m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |