aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs75
1 files changed, 41 insertions, 34 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 8643382..34481df 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -171,8 +171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
171 } 171 }
172 172
173 /// <summary> 173 /// <summary>
174 /// This method is called every time that we receive new UDP data. We pass this data on to the LLPacketServer 174 /// This method is called every time that we receive new UDP data.
175 /// except in the case that the packet is UseCircuitCode. In this case we set up the circuit code instead.
176 /// </summary> 175 /// </summary>
177 /// <param name="result"></param> 176 /// <param name="result"></param>
178 protected virtual void OnReceivedData(IAsyncResult result) 177 protected virtual void OnReceivedData(IAsyncResult result)
@@ -252,46 +251,54 @@ namespace OpenSim.Region.ClientStack.LindenUDP
252 BeginReceive(); 251 BeginReceive();
253 252
254 if (packet != null) 253 if (packet != null)
254 ProcessInPacket(packet);
255 }
256
257 /// <summary>
258 /// Process a successfully received packet. We pass the packet on to the LLPacketServer
259 /// except in the case that the packet is UseCircuitCode. In that case we set up the circuit code instead.
260 /// </summary>
261 /// <param name="packet"></param>
262 protected virtual void ProcessInPacket(Packet packet)
263 {
264 try
255 { 265 {
256 try 266 // do we already have a circuit for this endpoint
257 { 267 uint circuit;
258 // do we already have a circuit for this endpoint
259 uint circuit;
260 268
261 bool ret; 269 bool ret;
262 lock (clientCircuits) 270 lock (clientCircuits)
263 { 271 {
264 ret = clientCircuits.TryGetValue(epSender, out circuit); 272 ret = clientCircuits.TryGetValue(epSender, out circuit);
265 } 273 }
266 274
267 if (ret) 275 if (ret)
268 { 276 {
269 //if so then send packet to the packetserver 277 //if so then send packet to the packetserver
270 //m_log.DebugFormat("[UDPSERVER]: For endpoint {0} got packet {1}", epSender, packet.Type); 278 //m_log.DebugFormat("[UDPSERVER]: For endpoint {0} got packet {1}", epSender, packet.Type);
271 279
272 m_packetServer.InPacket(circuit, packet); 280 m_packetServer.InPacket(circuit, packet);
273 }
274 else if (packet.Type == PacketType.UseCircuitCode)
275 {
276 AddNewClient(packet);
277
278 UseCircuitCodePacket p = (UseCircuitCodePacket)packet;
279
280 // Ack the first UseCircuitCode packet
281 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
282 // TODO: don't create new blocks if recycling an old packet
283 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
284 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
285 ack_it.Packets[0].ID = packet.Header.Sequence;
286 ack_it.Header.Reliable = false;
287 SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code);
288 }
289 } 281 }
290 catch (Exception e) 282 else if (packet.Type == PacketType.UseCircuitCode)
291 { 283 {
292 m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e); 284 AddNewClient(packet);
285
286 UseCircuitCodePacket p = (UseCircuitCodePacket)packet;
287
288 // Ack the first UseCircuitCode packet
289 PacketAckPacket ack_it = (PacketAckPacket)PacketPool.Instance.GetPacket(PacketType.PacketAck);
290 // TODO: don't create new blocks if recycling an old packet
291 ack_it.Packets = new PacketAckPacket.PacketsBlock[1];
292 ack_it.Packets[0] = new PacketAckPacket.PacketsBlock();
293 ack_it.Packets[0].ID = packet.Header.Sequence;
294 ack_it.Header.Reliable = false;
295 SendPacketTo(ack_it.ToBytes(),ack_it.ToBytes().Length,SocketFlags.None,p.CircuitCode.Code);
293 } 296 }
294 } 297 }
298 catch (Exception e)
299 {
300 m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e);
301 }
295 } 302 }
296 303
297 private void BeginReceive() 304 private void BeginReceive()