diff options
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | 89 |
3 files changed, 91 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 49b9378..39eb968 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3121,7 +3121,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3121 | 3121 | ||
3122 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; | 3122 | objupdate.ObjectData = new ObjectUpdatePacket.ObjectDataBlock[1]; |
3123 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); | 3123 | objupdate.ObjectData[0] = CreateAvatarUpdateBlock(data); |
3124 | |||
3125 | OutPacket(objupdate, ThrottleOutPacketType.Task); | 3124 | OutPacket(objupdate, ThrottleOutPacketType.Task); |
3126 | } | 3125 | } |
3127 | 3126 | ||
@@ -3172,8 +3171,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3172 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); | 3171 | terse.ObjectData[i] = m_avatarTerseUpdates.Dequeue(); |
3173 | } | 3172 | } |
3174 | 3173 | ||
3175 | // HACK: Using the task category until the tiered reprioritization code is in | 3174 | OutPacket(terse, ThrottleOutPacketType.State); |
3176 | OutPacket(terse, ThrottleOutPacketType.Task); | ||
3177 | } | 3175 | } |
3178 | 3176 | ||
3179 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) | 3177 | public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 0b05ed9..4a7bdfe 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -571,23 +571,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
571 | //Sorry, i know it's not optimal, but until the LL client | 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. | 572 | //manages packets correctly and re-orders them as required, this is necessary. |
573 | 573 | ||
574 | if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate | 574 | |
575 | || outgoingPacket.Type == PacketType.ChatFromSimulator | 575 | // Put the UDP payload on the wire |
576 | || outgoingPacket.Type == PacketType.ObjectUpdate | 576 | if (outgoingPacket.Type == PacketType.ImprovedTerseObjectUpdate) |
577 | || outgoingPacket.Type == PacketType.LayerData) | ||
578 | { | 577 | { |
579 | sendSynchronous = true; | 578 | SyncBeginPrioritySend(buffer, 2); // highest priority |
580 | } | 579 | } |
581 | 580 | else if (outgoingPacket.Type == PacketType.ObjectUpdate | |
582 | // Put the UDP payload on the wire | 581 | || outgoingPacket.Type == PacketType.ChatFromSimulator |
583 | if (sendSynchronous == true) | 582 | || outgoingPacket.Type == PacketType.LayerData) |
584 | { | 583 | { |
585 | SyncBeginSend(buffer); | 584 | SyncBeginPrioritySend(buffer, 1); // medium priority |
586 | } | 585 | } |
587 | else | 586 | else |
588 | { | 587 | { |
589 | AsyncBeginSend(buffer); | 588 | SyncBeginPrioritySend(buffer, 0); // normal priority |
590 | } | 589 | } |
590 | |||
591 | //AsyncBeginSend(buffer); | ||
592 | |||
591 | // Keep track of when this packet was sent out (right now) | 593 | // Keep track of when this packet was sent out (right now) |
592 | outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; | 594 | outgoingPacket.TickCount = Environment.TickCount & Int32.MaxValue; |
593 | } | 595 | } |
@@ -862,7 +864,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
862 | 864 | ||
863 | Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length); | 865 | Buffer.BlockCopy(packetData, 0, buffer.Data, 0, length); |
864 | 866 | ||
865 | AsyncBeginSend(buffer); | 867 | SyncBeginPrioritySend(buffer, 1); //Setting this to a medium priority should help minimise resends |
866 | } | 868 | } |
867 | 869 | ||
868 | private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo) | 870 | private bool IsClientAuthorized(UseCircuitCodePacket useCircuitCode, out AuthenticateResponse sessionInfo) |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs index 63579ac..45d9170 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/OpenSimUDPBase.cs | |||
@@ -29,6 +29,7 @@ using System; | |||
29 | using System.Net; | 29 | using System.Net; |
30 | using System.Net.Sockets; | 30 | using System.Net.Sockets; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using System.Collections.Generic; | ||
32 | using log4net; | 33 | using log4net; |
33 | 34 | ||
34 | namespace OpenMetaverse | 35 | namespace OpenMetaverse |
@@ -52,12 +53,25 @@ namespace OpenMetaverse | |||
52 | /// <summary>Local IP address to bind to in server mode</summary> | 53 | /// <summary>Local IP address to bind to in server mode</summary> |
53 | protected IPAddress m_localBindAddress; | 54 | protected IPAddress m_localBindAddress; |
54 | 55 | ||
56 | /// <summary> | ||
57 | /// Standard queue for our outgoing SyncBeginPrioritySend | ||
58 | /// </summary> | ||
59 | private List<UDPPacketBuffer> m_standardQueue = new List<UDPPacketBuffer>(); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Prioritised queue for our outgoing SyncBeginPrioritySend | ||
63 | /// </summary> | ||
64 | private List<UDPPacketBuffer> m_priorityQueue = new List<UDPPacketBuffer>(); | ||
65 | |||
55 | /// <summary>UDP socket, used in either client or server mode</summary> | 66 | /// <summary>UDP socket, used in either client or server mode</summary> |
56 | private Socket m_udpSocket; | 67 | private Socket m_udpSocket; |
57 | 68 | ||
58 | /// <summary>Flag to process packets asynchronously or synchronously</summary> | 69 | /// <summary>Flag to process packets asynchronously or synchronously</summary> |
59 | private bool m_asyncPacketHandling; | 70 | private bool m_asyncPacketHandling; |
60 | 71 | ||
72 | /// <summary>Are we currently sending data asynchronously?</summary> | ||
73 | private volatile bool m_sendingData = false; | ||
74 | |||
61 | /// <summary>The all important shutdown flag</summary> | 75 | /// <summary>The all important shutdown flag</summary> |
62 | private volatile bool m_shutdownFlag = true; | 76 | private volatile bool m_shutdownFlag = true; |
63 | 77 | ||
@@ -246,25 +260,48 @@ namespace OpenMetaverse | |||
246 | } | 260 | } |
247 | } | 261 | } |
248 | 262 | ||
249 | public void SyncBeginSend(UDPPacketBuffer buf) | 263 | public void SyncBeginPrioritySend(UDPPacketBuffer buf, int Priority) |
250 | { | 264 | { |
251 | if (!m_shutdownFlag) | 265 | if (!m_shutdownFlag) |
252 | { | 266 | { |
253 | try | 267 | if (!m_sendingData) |
254 | { | 268 | { |
255 | m_udpSocket.SendTo( | 269 | m_sendingData = true; |
256 | buf.Data, | 270 | try |
257 | 0, | 271 | { |
258 | buf.DataLength, | 272 | AsyncBeginSend(buf); |
259 | SocketFlags.None, | 273 | } |
260 | buf.RemoteEndPoint); | 274 | catch (SocketException) { } |
275 | catch (ObjectDisposedException) { } | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | if (Priority == 2) | ||
280 | { | ||
281 | lock (m_priorityQueue) | ||
282 | { | ||
283 | m_priorityQueue.Add(buf); | ||
284 | } | ||
285 | } | ||
286 | else | ||
287 | { | ||
288 | lock (m_standardQueue) | ||
289 | { | ||
290 | if (Priority != 0) | ||
291 | { | ||
292 | m_standardQueue.Insert(0, buf); | ||
293 | } | ||
294 | else | ||
295 | { | ||
296 | m_standardQueue.Add(buf); | ||
297 | } | ||
298 | } | ||
299 | } | ||
261 | } | 300 | } |
262 | catch (SocketException) { } | ||
263 | catch (ObjectDisposedException) { } | ||
264 | } | 301 | } |
265 | } | 302 | } |
266 | 303 | ||
267 | public void AsyncBeginSend(UDPPacketBuffer buf) | 304 | private void AsyncBeginSend(UDPPacketBuffer buf) |
268 | { | 305 | { |
269 | if (!m_shutdownFlag) | 306 | if (!m_shutdownFlag) |
270 | { | 307 | { |
@@ -288,8 +325,36 @@ namespace OpenMetaverse | |||
288 | { | 325 | { |
289 | try | 326 | try |
290 | { | 327 | { |
291 | // UDPPacketBuffer buf = (UDPPacketBuffer)result.AsyncState; | ||
292 | m_udpSocket.EndSendTo(result); | 328 | m_udpSocket.EndSendTo(result); |
329 | |||
330 | if (m_sendingData) | ||
331 | { | ||
332 | lock (m_priorityQueue) | ||
333 | { | ||
334 | if (m_priorityQueue.Count > 0) | ||
335 | { | ||
336 | UDPPacketBuffer buf = m_priorityQueue[0]; | ||
337 | m_priorityQueue.RemoveAt(0); | ||
338 | AsyncBeginSend(buf); | ||
339 | } | ||
340 | else | ||
341 | { | ||
342 | lock (m_standardQueue) | ||
343 | { | ||
344 | if (m_standardQueue.Count > 0) | ||
345 | { | ||
346 | UDPPacketBuffer buf = m_standardQueue[0]; | ||
347 | m_standardQueue.RemoveAt(0); | ||
348 | AsyncBeginSend(buf); | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | m_sendingData = false; | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | } | ||
357 | } | ||
293 | } | 358 | } |
294 | catch (SocketException) { } | 359 | catch (SocketException) { } |
295 | catch (ObjectDisposedException) { } | 360 | catch (ObjectDisposedException) { } |