aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs28
1 files changed, 27 insertions, 1 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 8dec185..c01f6d6 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -30,6 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Net.Sockets; 32using System.Net.Sockets;
33using System.Threading;
33using System.Reflection; 34using System.Reflection;
34using libsecondlife.Packets; 35using libsecondlife.Packets;
35using log4net; 36using log4net;
@@ -69,6 +70,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
69 protected AssetCache m_assetCache; 70 protected AssetCache m_assetCache;
70 protected AgentCircuitManager m_authenticateSessionsClass; 71 protected AgentCircuitManager m_authenticateSessionsClass;
71 72
73 protected Queue<Packet> CreateUserPacket = new Queue<Packet>();
74
72 public LLPacketServer PacketServer 75 public LLPacketServer PacketServer
73 { 76 {
74 get { return m_packetServer; } 77 get { return m_packetServer; }
@@ -236,7 +239,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
236 { 239 {
237 // new client 240 // new client
238 m_log.Debug("[UDPSERVER]: Adding New Client"); 241 m_log.Debug("[UDPSERVER]: Adding New Client");
239 AddNewClient(packet);
240 242
241 UseCircuitCodePacket p = (UseCircuitCodePacket)packet; 243 UseCircuitCodePacket p = (UseCircuitCodePacket)packet;
242 244
@@ -248,6 +250,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
248 ack_it.Packets[0].ID = packet.Header.Sequence; 250 ack_it.Packets[0].ID = packet.Header.Sequence;
249 ack_it.Header.Reliable = false; 251 ack_it.Header.Reliable = false;
250 SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code); 252 SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code);
253
254 // toss it to a worker thread so IOthread can go home
255 lock (CreateUserPacket)
256 {
257 CreateUserPacket.Enqueue(packet);
258 }
259 WaitCallback createUserCallback = new WaitCallback(AddNewClient);
260 ThreadPool.QueueUserWorkItem(createUserCallback);
251 } 261 }
252 } 262 }
253 catch (Exception e) 263 catch (Exception e)
@@ -311,6 +321,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
311 } 321 }
312 } 322 }
313 323
324 /// <summary>
325 /// target of workerthread delegate to create a new user.
326 /// It assumes we get fired for each new user packet that comes in.
327 /// </summary>
328 /// <param name="o"></param>
329 protected void AddNewClient(object o)
330 {
331 Packet packet;
332 lock (CreateUserPacket)
333 {
334 packet = CreateUserPacket.Dequeue();
335 }
336 if (null != packet)
337 AddNewClient(packet);
338 }
339
314 protected virtual void AddNewClient(Packet packet) 340 protected virtual void AddNewClient(Packet packet)
315 { 341 {
316 //Slave regions don't accept new clients 342 //Slave regions don't accept new clients