diff options
Eased the locking times of ScenePresences. No locks were removed, just the locking periods changed.
* Added an additional lock in GetScenePresences()
* Changed ForEachClient to use GetScenePresences() instead of the main ScenePresences dictionary, so that there is no need to lock.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index fad90fa..9c3aa96 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -3175,13 +3175,16 @@ namespace OpenSim.Region.Environment.Scenes | |||
3175 | return; | 3175 | return; |
3176 | } | 3176 | } |
3177 | 3177 | ||
3178 | ScenePresence sp = null; | ||
3178 | lock (m_scenePresences) | 3179 | lock (m_scenePresences) |
3179 | { | 3180 | { |
3180 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) | 3181 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) |
3181 | { | 3182 | sp = m_scenePresences[remoteClient.AgentId]; |
3182 | m_sceneGridService.RequestTeleportToLocation(m_scenePresences[remoteClient.AgentId], info.RegionHandle, | 3183 | } |
3183 | position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); | 3184 | if (sp != null) |
3184 | } | 3185 | { |
3186 | m_sceneGridService.RequestTeleportToLocation(sp, info.RegionHandle, | ||
3187 | position, Vector3.Zero, (uint)(TPFlags.SetLastToTarget | TPFlags.ViaLandmark)); | ||
3185 | } | 3188 | } |
3186 | } | 3189 | } |
3187 | 3190 | ||
@@ -3417,36 +3420,40 @@ namespace OpenSim.Region.Environment.Scenes | |||
3417 | public void handleRequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike, | 3420 | public void handleRequestGodlikePowers(UUID agentID, UUID sessionID, UUID token, bool godLike, |
3418 | IClientAPI controllingClient) | 3421 | IClientAPI controllingClient) |
3419 | { | 3422 | { |
3423 | ScenePresence sp = null; | ||
3424 | |||
3420 | lock (m_scenePresences) | 3425 | lock (m_scenePresences) |
3421 | { | 3426 | { |
3422 | // User needs to be logged into this sim | 3427 | // User needs to be logged into this sim |
3423 | if (m_scenePresences.ContainsKey(agentID)) | 3428 | m_scenePresences.TryGetValue(agentID, out sp); |
3429 | } | ||
3430 | |||
3431 | if (sp != null) | ||
3432 | { | ||
3433 | if (godLike == false) | ||
3424 | { | 3434 | { |
3425 | if (godLike == false) | 3435 | sp.GrantGodlikePowers(agentID, sessionID, token, godLike); |
3426 | { | 3436 | return; |
3427 | m_scenePresences[agentID].GrantGodlikePowers(agentID, sessionID, token, godLike); | 3437 | } |
3428 | return; | ||
3429 | } | ||
3430 | 3438 | ||
3431 | // First check that this is the sim owner | 3439 | // First check that this is the sim owner |
3432 | if (Permissions.IsGod(agentID)) | 3440 | if (Permissions.IsGod(agentID)) |
3441 | { | ||
3442 | // Next we check for spoofing..... | ||
3443 | UUID testSessionID = sp.ControllingClient.SessionId; | ||
3444 | if (sessionID == testSessionID) | ||
3433 | { | 3445 | { |
3434 | // Next we check for spoofing..... | 3446 | if (sessionID == controllingClient.SessionId) |
3435 | UUID testSessionID = m_scenePresences[agentID].ControllingClient.SessionId; | ||
3436 | if (sessionID == testSessionID) | ||
3437 | { | 3447 | { |
3438 | if (sessionID == controllingClient.SessionId) | 3448 | //m_log.Info("godlike: " + godLike.ToString()); |
3439 | { | 3449 | sp.GrantGodlikePowers(agentID, testSessionID, token, godLike); |
3440 | //m_log.Info("godlike: " + godLike.ToString()); | ||
3441 | m_scenePresences[agentID].GrantGodlikePowers(agentID, testSessionID, token, godLike); | ||
3442 | } | ||
3443 | } | 3450 | } |
3444 | } | 3451 | } |
3445 | else | ||
3446 | { | ||
3447 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | ||
3448 | } | ||
3449 | } | 3452 | } |
3453 | else | ||
3454 | { | ||
3455 | m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); | ||
3456 | } | ||
3450 | } | 3457 | } |
3451 | } | 3458 | } |
3452 | 3459 | ||