diff options
author | Arthur Valadares | 2009-06-29 16:55:00 +0000 |
---|---|---|
committer | Arthur Valadares | 2009-06-29 16:55:00 +0000 |
commit | 6da88dceb0adb06c17f6f159824dabadc6634962 (patch) | |
tree | 7ae6e2dbb5419866bed42f416a5a1a3c83671fce /OpenSim/Region/ClientStack | |
parent | Update svn properties, add copyright header, formatting cleanup. (diff) | |
download | opensim-SC_OLD-6da88dceb0adb06c17f6f159824dabadc6634962.zip opensim-SC_OLD-6da88dceb0adb06c17f6f159824dabadc6634962.tar.gz opensim-SC_OLD-6da88dceb0adb06c17f6f159824dabadc6634962.tar.bz2 opensim-SC_OLD-6da88dceb0adb06c17f6f159824dabadc6634962.tar.xz |
* Changing List to Dictionary in PacketQueue.Dequeue for great justice (and performance)
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs index 3844b1d..c19428d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketQueue.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
83 | internal LLPacketThrottle TextureThrottle; | 83 | internal LLPacketThrottle TextureThrottle; |
84 | internal LLPacketThrottle TotalThrottle; | 84 | internal LLPacketThrottle TotalThrottle; |
85 | 85 | ||
86 | private List<uint> contents = new List<uint>(); | 86 | private Dictionary<uint,int> contents = new Dictionary<uint, int>(); |
87 | 87 | ||
88 | /// <summary> | 88 | /// <summary> |
89 | /// The number of packets in the OutgoingPacketQueue | 89 | /// The number of packets in the OutgoingPacketQueue |
@@ -189,7 +189,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
189 | } | 189 | } |
190 | 190 | ||
191 | if (item.Sequence != 0) | 191 | if (item.Sequence != 0) |
192 | lock (contents) contents.Add(item.Sequence); | 192 | lock (contents) |
193 | { | ||
194 | if (contents.ContainsKey(item.Sequence)) | ||
195 | contents[item.Sequence] += 1; | ||
196 | else | ||
197 | contents.Add(item.Sequence, 1); | ||
198 | } | ||
193 | 199 | ||
194 | lock (this) | 200 | lock (this) |
195 | { | 201 | { |
@@ -243,22 +249,26 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
243 | return item; | 249 | return item; |
244 | lock (contents) | 250 | lock (contents) |
245 | { | 251 | { |
246 | if (contents.Contains(item.Sequence)) | 252 | if (contents.ContainsKey(item.Sequence)) |
247 | if (contents.Remove(item.Sequence)) | 253 | { |
248 | return item; | 254 | if (contents[item.Sequence] == 1) |
255 | contents.Remove(item.Sequence); | ||
256 | else | ||
257 | contents[item.Sequence] -= 1; | ||
258 | return item; | ||
259 | } | ||
249 | } | 260 | } |
250 | } | 261 | } |
251 | } | 262 | } |
252 | 263 | ||
253 | public void Cancel(uint sequence) | 264 | public void Cancel(uint sequence) |
254 | { | 265 | { |
255 | lock (contents) while (contents.Remove(sequence)) | 266 | lock (contents) contents.Remove(sequence); |
256 | ; | ||
257 | } | 267 | } |
258 | 268 | ||
259 | public bool Contains(uint sequence) | 269 | public bool Contains(uint sequence) |
260 | { | 270 | { |
261 | lock (contents) return contents.Contains(sequence); | 271 | lock (contents) return contents.ContainsKey(sequence); |
262 | } | 272 | } |
263 | 273 | ||
264 | public void Flush() | 274 | public void Flush() |