diff options
author | Melanie | 2009-10-07 01:45:49 +0100 |
---|---|---|
committer | Melanie | 2009-10-07 01:45:49 +0100 |
commit | 89d23a1fa23cb191e7ebde047311adcadf3b2e45 (patch) | |
tree | 461ef0fdd6640a17db5b3d989f0e02b1cf40252e /OpenSim/Region/ClientStack | |
parent | Rewrote parts of the code that were double-locking different objects. This is... (diff) | |
download | opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.zip opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.gz opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.bz2 opensim-SC-89d23a1fa23cb191e7ebde047311adcadf3b2e45.tar.xz |
Revert "Rewrote parts of the code that were double-locking different objects. This is about half of the code base reviewed."
This reverts commit e992ca025571a891333a57012c2cd4419b6581e5.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 116 |
1 files changed, 47 insertions, 69 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index fe37a08..0052729 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3122,7 +3122,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3122 | objectData.TextureAnim = textureanim; | 3122 | objectData.TextureAnim = textureanim; |
3123 | } | 3123 | } |
3124 | 3124 | ||
3125 | bool doUpdate = false; | ||
3126 | lock (m_primFullUpdates) | 3125 | lock (m_primFullUpdates) |
3127 | { | 3126 | { |
3128 | if (m_primFullUpdates.Count == 0) | 3127 | if (m_primFullUpdates.Count == 0) |
@@ -3131,10 +3130,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3131 | m_primFullUpdates.Add(objectData); | 3130 | m_primFullUpdates.Add(objectData); |
3132 | 3131 | ||
3133 | if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) | 3132 | if (m_primFullUpdates.Count >= m_primFullUpdatesPerPacket) |
3134 | doUpdate = true; | 3133 | ProcessPrimFullUpdates(this, null); |
3135 | } | 3134 | } |
3136 | if (doUpdate) | ||
3137 | ProcessPrimFullUpdates(this, null); | ||
3138 | } | 3135 | } |
3139 | 3136 | ||
3140 | void HandleQueueEmpty(ThrottleOutPacketType queue) | 3137 | void HandleQueueEmpty(ThrottleOutPacketType queue) |
@@ -3155,40 +3152,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3155 | 3152 | ||
3156 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) | 3153 | void ProcessPrimFullUpdates(object sender, ElapsedEventArgs e) |
3157 | { | 3154 | { |
3158 | bool stopTimer = false; | ||
3159 | lock (m_primFullUpdates) | 3155 | lock (m_primFullUpdates) |
3160 | { | 3156 | { |
3161 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3157 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3162 | stopTimer = true; | 3158 | { |
3163 | } | 3159 | lock (m_primFullUpdateTimer) |
3164 | if (stopTimer) | 3160 | m_primFullUpdateTimer.Stop(); |
3165 | { | 3161 | |
3166 | lock (m_primFullUpdateTimer) | 3162 | return; |
3167 | m_primFullUpdateTimer.Stop(); | 3163 | } |
3168 | return; | ||
3169 | } | ||
3170 | 3164 | ||
3171 | ObjectUpdatePacket outPacket = | 3165 | ObjectUpdatePacket outPacket = |
3172 | (ObjectUpdatePacket)PacketPool.Instance.GetPacket( | 3166 | (ObjectUpdatePacket)PacketPool.Instance.GetPacket( |
3173 | PacketType.ObjectUpdate); | 3167 | PacketType.ObjectUpdate); |
3174 | 3168 | ||
3175 | outPacket.RegionData.RegionHandle = | 3169 | outPacket.RegionData.RegionHandle = |
3176 | Scene.RegionInfo.RegionHandle; | 3170 | Scene.RegionInfo.RegionHandle; |
3177 | outPacket.RegionData.TimeDilation = | 3171 | outPacket.RegionData.TimeDilation = |
3178 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | 3172 | (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3179 | 3173 | ||
3180 | int max = m_primFullUpdates.Count; | 3174 | int max = m_primFullUpdates.Count; |
3181 | if (max > m_primFullUpdatesPerPacket) | 3175 | if (max > m_primFullUpdatesPerPacket) |
3182 | max = m_primFullUpdatesPerPacket; | 3176 | max = m_primFullUpdatesPerPacket; |
3183 | 3177 | ||
3184 | int count = 0; | 3178 | int count = 0; |
3185 | int size = 0; | 3179 | int size = 0; |
3186 | 3180 | ||
3187 | byte[] zerobuffer = new byte[1024]; | 3181 | byte[] zerobuffer = new byte[1024]; |
3188 | byte[] blockbuffer = new byte[1024]; | 3182 | byte[] blockbuffer = new byte[1024]; |
3189 | 3183 | ||
3190 | lock (m_primFullUpdates) | ||
3191 | { | ||
3192 | for (count = 0 ; count < max ; count++) | 3184 | for (count = 0 ; count < max ; count++) |
3193 | { | 3185 | { |
3194 | int length = 0; | 3186 | int length = 0; |
@@ -3212,12 +3204,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3212 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 3204 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
3213 | 3205 | ||
3214 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) | 3206 | if (m_primFullUpdates.Count == 0 && m_primFullUpdateTimer.Enabled) |
3215 | stopTimer = true; | 3207 | lock (m_primFullUpdateTimer) |
3208 | m_primFullUpdateTimer.Stop(); | ||
3216 | } | 3209 | } |
3217 | |||
3218 | if (stopTimer) | ||
3219 | lock (m_primFullUpdateTimer) | ||
3220 | m_primFullUpdateTimer.Stop(); | ||
3221 | } | 3210 | } |
3222 | 3211 | ||
3223 | /// <summary> | 3212 | /// <summary> |
@@ -3236,7 +3225,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3236 | CreatePrimImprovedBlock(localID, position, rotation, | 3225 | CreatePrimImprovedBlock(localID, position, rotation, |
3237 | velocity, rotationalvelocity, state); | 3226 | velocity, rotationalvelocity, state); |
3238 | 3227 | ||
3239 | bool doUpdate = false; | ||
3240 | lock (m_primTerseUpdates) | 3228 | lock (m_primTerseUpdates) |
3241 | { | 3229 | { |
3242 | if (m_primTerseUpdates.Count == 0) | 3230 | if (m_primTerseUpdates.Count == 0) |
@@ -3245,51 +3233,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3245 | m_primTerseUpdates.Add(objectData); | 3233 | m_primTerseUpdates.Add(objectData); |
3246 | 3234 | ||
3247 | if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) | 3235 | if (m_primTerseUpdates.Count >= m_primTerseUpdatesPerPacket) |
3248 | doUpdate = true; | 3236 | ProcessPrimTerseUpdates(this, null); |
3249 | } | 3237 | } |
3250 | if (doUpdate) | ||
3251 | ProcessPrimTerseUpdates(this, null); | ||
3252 | } | 3238 | } |
3253 | 3239 | ||
3254 | void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) | 3240 | void ProcessPrimTerseUpdates(object sender, ElapsedEventArgs e) |
3255 | { | 3241 | { |
3256 | bool stopTimer = false; | ||
3257 | lock (m_primTerseUpdates) | 3242 | lock (m_primTerseUpdates) |
3258 | { | 3243 | { |
3259 | if (m_primTerseUpdates.Count == 0) | 3244 | if (m_primTerseUpdates.Count == 0) |
3260 | stopTimer = true; | 3245 | { |
3261 | } | 3246 | lock (m_primTerseUpdateTimer) |
3262 | if (stopTimer) | 3247 | m_primTerseUpdateTimer.Stop(); |
3263 | { | ||
3264 | lock (m_primTerseUpdateTimer) | ||
3265 | m_primTerseUpdateTimer.Stop(); | ||
3266 | 3248 | ||
3267 | return; | 3249 | return; |
3268 | } | 3250 | } |
3269 | 3251 | ||
3270 | ImprovedTerseObjectUpdatePacket outPacket = | 3252 | ImprovedTerseObjectUpdatePacket outPacket = |
3271 | (ImprovedTerseObjectUpdatePacket) | 3253 | (ImprovedTerseObjectUpdatePacket) |
3272 | PacketPool.Instance.GetPacket( | 3254 | PacketPool.Instance.GetPacket( |
3273 | PacketType.ImprovedTerseObjectUpdate); | 3255 | PacketType.ImprovedTerseObjectUpdate); |
3274 | 3256 | ||
3275 | outPacket.RegionData.RegionHandle = | 3257 | outPacket.RegionData.RegionHandle = |
3276 | Scene.RegionInfo.RegionHandle; | 3258 | Scene.RegionInfo.RegionHandle; |
3277 | outPacket.RegionData.TimeDilation = | 3259 | outPacket.RegionData.TimeDilation = |
3278 | (ushort)(Scene.TimeDilation * ushort.MaxValue); | 3260 | (ushort)(Scene.TimeDilation * ushort.MaxValue); |
3279 | 3261 | ||
3280 | int max = m_primTerseUpdates.Count; | 3262 | int max = m_primTerseUpdates.Count; |
3281 | if (max > m_primTerseUpdatesPerPacket) | 3263 | if (max > m_primTerseUpdatesPerPacket) |
3282 | max = m_primTerseUpdatesPerPacket; | 3264 | max = m_primTerseUpdatesPerPacket; |
3283 | 3265 | ||
3284 | int count = 0; | 3266 | int count = 0; |
3285 | int size = 0; | 3267 | int size = 0; |
3286 | 3268 | ||
3287 | byte[] zerobuffer = new byte[1024]; | 3269 | byte[] zerobuffer = new byte[1024]; |
3288 | byte[] blockbuffer = new byte[1024]; | 3270 | byte[] blockbuffer = new byte[1024]; |
3289 | 3271 | ||
3290 | lock (m_primTerseUpdates) | 3272 | for (count = 0 ; count < max ; count++) |
3291 | { | ||
3292 | for (count = 0; count < max; count++) | ||
3293 | { | 3273 | { |
3294 | int length = 0; | 3274 | int length = 0; |
3295 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); | 3275 | m_primTerseUpdates[count].ToBytes(blockbuffer, ref length); |
@@ -3314,11 +3294,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3314 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); | 3294 | OutPacket(outPacket, ThrottleOutPacketType.Task | ThrottleOutPacketType.LowPriority); |
3315 | 3295 | ||
3316 | if (m_primTerseUpdates.Count == 0) | 3296 | if (m_primTerseUpdates.Count == 0) |
3317 | stopTimer = true; | 3297 | lock (m_primTerseUpdateTimer) |
3298 | m_primTerseUpdateTimer.Stop(); | ||
3318 | } | 3299 | } |
3319 | if (stopTimer) | ||
3320 | lock (m_primTerseUpdateTimer) | ||
3321 | m_primTerseUpdateTimer.Stop(); | ||
3322 | } | 3300 | } |
3323 | 3301 | ||
3324 | public void FlushPrimUpdates() | 3302 | public void FlushPrimUpdates() |