From e44e1ccbd32745e25ecf750a6bd0e212e4dfd535 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Jul 2010 00:16:37 +0100
Subject: implement code to deregister users on DeregisterCaps
---
.../CoreModules/World/Media/Moap/MoapModule.cs | 37 ++++++++++++++++++++--
1 file changed, 34 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World')
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 09786ec..ce4e921 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -64,15 +64,25 @@ namespace OpenSim.Region.CoreModules.Media.Moap
protected Scene m_scene;
///
- /// Track the ObjectMedia capabilities given to users
+ /// Track the ObjectMedia capabilities given to users keyed by path
///
protected Dictionary m_omCapUsers = new Dictionary();
///
- /// Track the ObjectMediaUpdate capabilities given to users
+ /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
+ ///
+ protected Dictionary m_omCapUrls = new Dictionary();
+
+ ///
+ /// Track the ObjectMediaUpdate capabilities given to users keyed by path
///
protected Dictionary m_omuCapUsers = new Dictionary();
+ ///
+ /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
+ ///
+ protected Dictionary m_omuCapUrls = new Dictionary();
+
public void Initialise(IConfigSource config)
{
// TODO: Add config switches to enable/disable this module
@@ -88,11 +98,13 @@ namespace OpenSim.Region.CoreModules.Media.Moap
public void RegionLoaded(Scene scene)
{
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
+ m_scene.EventManager.OnDeregisterCaps += DeregisterCaps;
}
public void Close()
{
m_scene.EventManager.OnRegisterCaps -= RegisterCaps;
+ m_scene.EventManager.OnDeregisterCaps -= DeregisterCaps;
}
public void RegisterCaps(UUID agentID, Caps caps)
@@ -105,6 +117,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
lock (m_omCapUsers)
{
m_omCapUsers[omCapUrl] = agentID;
+ m_omCapUrls[agentID] = omCapUrl;
// Even though we're registering for POST we're going to get GETS and UPDATES too
caps.RegisterHandler(
@@ -116,12 +129,30 @@ namespace OpenSim.Region.CoreModules.Media.Moap
lock (m_omuCapUsers)
{
m_omuCapUsers[omuCapUrl] = agentID;
+ m_omuCapUrls[agentID] = omuCapUrl;
// Even though we're registering for POST we're going to get GETS and UPDATES too
caps.RegisterHandler(
"ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
}
- }
+ }
+
+ public void DeregisterCaps(UUID agentID, Caps caps)
+ {
+ lock (m_omCapUsers)
+ {
+ string path = m_omCapUrls[agentID];
+ m_omCapUrls.Remove(agentID);
+ m_omCapUsers.Remove(path);
+ }
+
+ lock (m_omuCapUsers)
+ {
+ string path = m_omuCapUrls[agentID];
+ m_omuCapUrls.Remove(agentID);
+ m_omuCapUsers.Remove(path);
+ }
+ }
public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
{
--
cgit v1.1