aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ClientStack
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs24
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs18
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs4
3 files changed, 43 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index c773c05..0b05ed9 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -399,6 +399,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
399 #region Queue or Send 399 #region Queue or Send
400 400
401 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category); 401 OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category);
402 outgoingPacket.Type = type;
402 403
403 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket)) 404 if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
404 SendPacketFinal(outgoingPacket); 405 SendPacketFinal(outgoingPacket);
@@ -510,6 +511,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
510 byte flags = buffer.Data[0]; 511 byte flags = buffer.Data[0];
511 bool isResend = (flags & Helpers.MSG_RESENT) != 0; 512 bool isResend = (flags & Helpers.MSG_RESENT) != 0;
512 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; 513 bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0;
514 bool sendSynchronous = false;
513 LLUDPClient udpClient = outgoingPacket.Client; 515 LLUDPClient udpClient = outgoingPacket.Client;
514 516
515 if (!udpClient.IsConnected) 517 if (!udpClient.IsConnected)
@@ -565,9 +567,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
565 if (isReliable) 567 if (isReliable)
566 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength); 568 Interlocked.Add(ref udpClient.UnackedBytes, outgoingPacket.Buffer.DataLength);
567 569
568 // Put the UDP payload on the wire 570 //Some packet types need to be sent synchonously.
569 AsyncBeginSend(buffer); 571 //Sorry, i know it's not optimal, but until the LL client
572 //manages packets correctly and re-orders them as required, this is necessary.
573
574 if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate
575 || outgoingPacket.Type == PacketType.ChatFromSimulator
576 || outgoingPacket.Type == PacketType.ObjectUpdate
577 || outgoingPacket.Type == PacketType.LayerData)
578 {
579 sendSynchronous = true;
580 }
570 581
582 // Put the UDP payload on the wire
583 if (sendSynchronous == true)
584 {
585 SyncBeginSend(buffer);
586 }
587 else
588 {
589 AsyncBeginSend(buffer);
590 }
571 // Keep track of when this packet was sent out (right now) 591 // Keep track of when this packet was sent out (right now)
572 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; 592 outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue;
573 } 593 }
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
index d2779ba..63579ac 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs
@@ -246,6 +246,24 @@ namespace OpenMetaverse
246 } 246 }
247 } 247 }
248 248
249 public void SyncBeginSend(UDPPacketBuffer buf)
250 {
251 if (!m_shutdownFlag)
252 {
253 try
254 {
255 m_udpSocket.SendTo(
256 buf.Data,
257 0,
258 buf.DataLength,
259 SocketFlags.None,
260 buf.RemoteEndPoint);
261 }
262 catch (SocketException) { }
263 catch (ObjectDisposedException) { }
264 }
265 }
266
249 public void AsyncBeginSend(UDPPacketBuffer buf) 267 public void AsyncBeginSend(UDPPacketBuffer buf)
250 { 268 {
251 if (!m_shutdownFlag) 269 if (!m_shutdownFlag)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
index 1a1a1cb..7dc42d3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/OutgoingPacket.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenSim.Framework; 29using OpenSim.Framework;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets;
31 32
32namespace OpenSim.Region.ClientStack.LindenUDP 33namespace OpenSim.Region.ClientStack.LindenUDP
33{ 34{
@@ -52,7 +53,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
52 public int TickCount; 53 public int TickCount;
53 /// <summary>Category this packet belongs to</summary> 54 /// <summary>Category this packet belongs to</summary>
54 public ThrottleOutPacketType Category; 55 public ThrottleOutPacketType Category;
55 56 /// <summary>The type of packet so its delivery method can be determined</summary>
57 public PacketType Type;
56 /// <summary> 58 /// <summary>
57 /// Default constructor 59 /// Default constructor
58 /// </summary> 60 /// </summary>