diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs index d195110..90a87fa 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/UnackedPacketCollection.cs | |||
@@ -83,6 +83,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Marks a packet as acknowledged | 85 | /// Marks a packet as acknowledged |
86 | /// This method is used when an acknowledgement is received from the network for a previously | ||
87 | /// sent packet. Effects of removal this way are to update unacked byte count, adjust RTT | ||
88 | /// and increase throttle to the coresponding client. | ||
86 | /// </summary> | 89 | /// </summary> |
87 | /// <param name="sequenceNumber">Sequence number of the packet to | 90 | /// <param name="sequenceNumber">Sequence number of the packet to |
88 | /// acknowledge</param> | 91 | /// acknowledge</param> |
@@ -95,6 +98,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
95 | } | 98 | } |
96 | 99 | ||
97 | /// <summary> | 100 | /// <summary> |
101 | /// Marks a packet as no longer needing acknowledgement without a received acknowledgement. | ||
102 | /// This method is called when a packet expires and we no longer need an acknowledgement. | ||
103 | /// When some reliable packet types expire, they are handled in a way other than simply | ||
104 | /// resending them. The only effect of removal this way is to update unacked byte count. | ||
105 | /// </summary> | ||
106 | /// <param name="sequenceNumber">Sequence number of the packet to | ||
107 | /// acknowledge</param> | ||
108 | /// <remarks>The packet is removed from the collection immediately. | ||
109 | /// This function is not threadsafe. It must be called by the thread calling GetExpiredPackets.</remarks> | ||
110 | public void Remove(uint sequenceNumber) | ||
111 | { | ||
112 | OutgoingPacket removedPacket; | ||
113 | if (m_packets.TryGetValue(sequenceNumber, out removedPacket)) | ||
114 | { | ||
115 | if (removedPacket != null) | ||
116 | { | ||
117 | m_packets.Remove(sequenceNumber); | ||
118 | |||
119 | // Update stats | ||
120 | Interlocked.Add(ref removedPacket.Client.UnackedBytes, -removedPacket.Buffer.DataLength); | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | |||
125 | /// <summary> | ||
98 | /// Returns a list of all of the packets with a TickCount older than | 126 | /// Returns a list of all of the packets with a TickCount older than |
99 | /// the specified timeout | 127 | /// the specified timeout |
100 | /// </summary> | 128 | /// </summary> |
@@ -130,6 +158,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
130 | // is actually sent out again | 158 | // is actually sent out again |
131 | packet.TickCount = 0; | 159 | packet.TickCount = 0; |
132 | 160 | ||
161 | // As with other network applications, assume that an expired packet is | ||
162 | // an indication of some network problem, slow transmission | ||
163 | packet.Client.FlowThrottle.ExpirePackets(1); | ||
164 | |||
133 | expiredPackets.Add(packet); | 165 | expiredPackets.Add(packet); |
134 | } | 166 | } |
135 | } | 167 | } |
@@ -157,6 +189,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
157 | { | 189 | { |
158 | m_packets.Remove(pendingRemove.SequenceNumber); | 190 | m_packets.Remove(pendingRemove.SequenceNumber); |
159 | 191 | ||
192 | // As with other network applications, assume that an acknowledged packet is an | ||
193 | // indication that the network can handle a little more load, speed up the transmission | ||
194 | ackedPacket.Client.FlowThrottle.AcknowledgePackets(ackedPacket.Buffer.DataLength); | ||
195 | |||
160 | // Update stats | 196 | // Update stats |
161 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); | 197 | Interlocked.Add(ref ackedPacket.Client.UnackedBytes, -ackedPacket.Buffer.DataLength); |
162 | 198 | ||