diff options
author | John Hurliman | 2010-04-02 16:25:14 -0700 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-05-20 23:38:38 +0100 |
commit | 1c63f6cd850a76b269df81aa89de17429c65ad60 (patch) | |
tree | 241d6c82eb63aa447cba773cf7818886ef524f2c /OpenSim/Region/ClientStack | |
parent | When saving an oar/iar, don't attempt to write out the data byte array if it'... (diff) | |
download | opensim-SC-1c63f6cd850a76b269df81aa89de17429c65ad60.zip opensim-SC-1c63f6cd850a76b269df81aa89de17429c65ad60.tar.gz opensim-SC-1c63f6cd850a76b269df81aa89de17429c65ad60.tar.bz2 opensim-SC-1c63f6cd850a76b269df81aa89de17429c65ad60.tar.xz |
Don't append ACKs to zerocoded packets. Although this should fine in theory, I'm seeing the viewer ignore or fail to parse ACKs appended to our zerocoded packets. This should cut down on viewer->sim resend traffic
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 3c4fa72..5ed4cd7 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -513,6 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
513 | byte flags = buffer.Data[0]; | 513 | byte flags = buffer.Data[0]; |
514 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; | 514 | bool isResend = (flags & Helpers.MSG_RESENT) != 0; |
515 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; | 515 | bool isReliable = (flags & Helpers.MSG_RELIABLE) != 0; |
516 | bool isZerocoded = (flags & Helpers.MSG_ZEROCODED) != 0; | ||
516 | LLUDPClient udpClient = outgoingPacket.Client; | 517 | LLUDPClient udpClient = outgoingPacket.Client; |
517 | 518 | ||
518 | if (!udpClient.IsConnected) | 519 | if (!udpClient.IsConnected) |
@@ -522,23 +523,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
522 | 523 | ||
523 | int dataLength = buffer.DataLength; | 524 | int dataLength = buffer.DataLength; |
524 | 525 | ||
525 | // Keep appending ACKs until there is no room left in the buffer or there are | 526 | // NOTE: I'm seeing problems with some viewers when ACKs are appended to zerocoded packets so I've disabled that here |
526 | // no more ACKs to append | 527 | if (!isZerocoded) |
527 | uint ackCount = 0; | ||
528 | uint ack; | ||
529 | while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack)) | ||
530 | { | 528 | { |
531 | Utils.UIntToBytesBig(ack, buffer.Data, dataLength); | 529 | // Keep appending ACKs until there is no room left in the buffer or there are |
532 | dataLength += 4; | 530 | // no more ACKs to append |
533 | ++ackCount; | 531 | uint ackCount = 0; |
534 | } | 532 | uint ack; |
533 | while (dataLength + 5 < buffer.Data.Length && udpClient.PendingAcks.Dequeue(out ack)) | ||
534 | { | ||
535 | Utils.UIntToBytesBig(ack, buffer.Data, dataLength); | ||
536 | dataLength += 4; | ||
537 | ++ackCount; | ||
538 | } | ||
535 | 539 | ||
536 | if (ackCount > 0) | 540 | if (ackCount > 0) |
537 | { | 541 | { |
538 | // Set the last byte of the packet equal to the number of appended ACKs | 542 | // Set the last byte of the packet equal to the number of appended ACKs |
539 | buffer.Data[dataLength++] = (byte)ackCount; | 543 | buffer.Data[dataLength++] = (byte)ackCount; |
540 | // Set the appended ACKs flag on this packet | 544 | // Set the appended ACKs flag on this packet |
541 | buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS); | 545 | buffer.Data[0] = (byte)(buffer.Data[0] | Helpers.MSG_APPENDED_ACKS); |
546 | } | ||
542 | } | 547 | } |
543 | 548 | ||
544 | buffer.DataLength = dataLength; | 549 | buffer.DataLength = dataLength; |