diff options
author | Justin Clarke Casey | 2008-03-25 17:08:20 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-03-25 17:08:20 +0000 |
commit | 2517fe7acd97fd93a73d936664415008c0099b00 (patch) | |
tree | 504b65b809dde252e85314eed2a7cdc61a43fbf9 | |
parent | Update svn properties. (diff) | |
download | opensim-SC_OLD-2517fe7acd97fd93a73d936664415008c0099b00.zip opensim-SC_OLD-2517fe7acd97fd93a73d936664415008c0099b00.tar.gz opensim-SC_OLD-2517fe7acd97fd93a73d936664415008c0099b00.tar.bz2 opensim-SC_OLD-2517fe7acd97fd93a73d936664415008c0099b00.tar.xz |
* Remove old CAPS http listeners when a client logs out from a scene
* Not yet removing listeners when a client leaves a region without logging out
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 3 |
2 files changed, 41 insertions, 22 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index cac0571..c9e7507 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -68,15 +68,15 @@ namespace OpenSim.Region.Capabilities | |||
68 | private string m_capsObjectPath; | 68 | private string m_capsObjectPath; |
69 | public string CapsObjectPath { get { return m_capsObjectPath; } } | 69 | public string CapsObjectPath { get { return m_capsObjectPath; } } |
70 | 70 | ||
71 | private string m_requestPath = "0000/"; | 71 | private static readonly string m_requestPath = "0000/"; |
72 | private string m_mapLayerPath = "0001/"; | 72 | private static readonly string m_mapLayerPath = "0001/"; |
73 | private string m_newInventory = "0002/"; | 73 | private static readonly string m_newInventory = "0002/"; |
74 | //private string m_requestTexture = "0003/"; | 74 | //private static readonly string m_requestTexture = "0003/"; |
75 | private string m_notecardUpdatePath = "0004/"; | 75 | private static readonly string m_notecardUpdatePath = "0004/"; |
76 | private string m_notecardTaskUpdatePath = "0005/"; | 76 | private static readonly string m_notecardTaskUpdatePath = "0005/"; |
77 | private string m_fetchInventoryPath = "0006/"; | 77 | private static readonly string m_fetchInventoryPath = "0006/"; |
78 | private string m_parcelVoiceInfoRequestPath = "0007/"; | 78 | private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; |
79 | private string m_provisionVoiceAccountRequestPath = "0008/"; | 79 | private static readonly string m_provisionVoiceAccountRequestPath = "0008/"; |
80 | 80 | ||
81 | //private string eventQueue = "0100/"; | 81 | //private string eventQueue = "0100/"; |
82 | private BaseHttpServer m_httpListener; | 82 | private BaseHttpServer m_httpListener; |
@@ -94,7 +94,6 @@ namespace OpenSim.Region.Capabilities | |||
94 | // | 94 | // |
95 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | 95 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; |
96 | 96 | ||
97 | |||
98 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 97 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
99 | LLUUID agent, bool dumpAssetsToFile) | 98 | LLUUID agent, bool dumpAssetsToFile) |
100 | { | 99 | { |
@@ -108,25 +107,23 @@ namespace OpenSim.Region.Capabilities | |||
108 | } | 107 | } |
109 | 108 | ||
110 | /// <summary> | 109 | /// <summary> |
111 | /// | 110 | /// Register all CAPS http service handlers |
112 | /// </summary> | 111 | /// </summary> |
113 | public void RegisterHandlers() | 112 | public void RegisterHandlers() |
114 | { | 113 | { |
115 | string capsBase = "/CAPS/" + m_capsObjectPath; | 114 | DeregisterHandlers(); |
115 | |||
116 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
116 | 117 | ||
117 | try | 118 | try |
118 | { | 119 | { |
119 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath); | ||
120 | m_httpListener.AddStreamHandler( | 120 | m_httpListener.AddStreamHandler( |
121 | new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, | 121 | new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", capsBase + m_mapLayerPath, GetMapLayer)); |
122 | GetMapLayer)); | ||
123 | |||
124 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory); | ||
125 | m_httpListener.AddStreamHandler( | 122 | m_httpListener.AddStreamHandler( |
126 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", | 123 | new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", |
127 | capsBase + m_newInventory, | 124 | capsBase + m_newInventory, |
128 | NewAgentInventoryRequest)); | 125 | NewAgentInventoryRequest)); |
129 | 126 | ||
130 | // m_httpListener.AddStreamHandler( | 127 | // m_httpListener.AddStreamHandler( |
131 | // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", | 128 | // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", |
132 | // capsBase + m_fetchInventory, | 129 | // capsBase + m_fetchInventory, |
@@ -147,14 +144,35 @@ namespace OpenSim.Region.Capabilities | |||
147 | } | 144 | } |
148 | } | 145 | } |
149 | 146 | ||
147 | /// <summary> | ||
148 | /// Remove all CAPS service handlers. | ||
149 | /// | ||
150 | /// FIXME: Would be much nicer to remove and all paths to a single list. However, this is a little awkward | ||
151 | /// than it could be as we set up some handlers differently (legacy and non-legacy) | ||
152 | /// </summary> | ||
153 | /// <param name="httpListener"></param> | ||
154 | /// <param name="path"></param> | ||
155 | /// <param name="restMethod"></param> | ||
156 | public void DeregisterHandlers() | ||
157 | { | ||
158 | string capsBase = "/CAPS/" + m_capsObjectPath; | ||
159 | |||
160 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_mapLayerPath); | ||
161 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_newInventory); | ||
162 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_requestPath); | ||
163 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_parcelVoiceInfoRequestPath); | ||
164 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_provisionVoiceAccountRequestPath); | ||
165 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_notecardUpdatePath); | ||
166 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_notecardTaskUpdatePath); | ||
167 | m_httpListener.RemoveStreamHandler("POST", capsBase + m_fetchInventoryPath); | ||
168 | } | ||
150 | 169 | ||
151 | //[Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] | 170 | //[Obsolete("Use BaseHttpServer.AddStreamHandler(new LLSDStreamHandler( LLSDMethod delegate )) instead.")] |
152 | //Commented out the obsolete as at this time the first caps request can not use the new Caps method | 171 | //Commented out the obsolete as at this time the first caps request can not use the new Caps method |
153 | //as the sent type is a array and not a map and the deserialising doesn't deal properly with arrays. | 172 | //as the sent type is a array and not a map and the deserialising doesn't deal properly with arrays. |
154 | private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) | 173 | private void AddLegacyCapsHandler(BaseHttpServer httpListener, string path, RestMethod restMethod) |
155 | { | 174 | { |
156 | string capsBase = "/CAPS/" + m_capsObjectPath; | 175 | string capsBase = "/CAPS/" + m_capsObjectPath; |
157 | httpListener.RemoveStreamHandler("POST", capsBase + path); | ||
158 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); | 176 | httpListener.AddStreamHandler(new RestStreamHandler("POST", capsBase + path, restMethod)); |
159 | } | 177 | } |
160 | 178 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bba5ae1..75f8c23 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1463,7 +1463,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1463 | } | 1463 | } |
1464 | 1464 | ||
1465 | /// <summary> | 1465 | /// <summary> |
1466 | /// Remove the given presence from the scene. | 1466 | /// Remove the given client from the scene. |
1467 | /// </summary> | 1467 | /// </summary> |
1468 | /// <param name="agentID"></param> | 1468 | /// <param name="agentID"></param> |
1469 | public override void RemoveClient(LLUUID agentID) | 1469 | public override void RemoveClient(LLUUID agentID) |
@@ -1496,6 +1496,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1496 | 1496 | ||
1497 | if (m_capsHandlers.ContainsKey(agentID)) | 1497 | if (m_capsHandlers.ContainsKey(agentID)) |
1498 | { | 1498 | { |
1499 | m_capsHandlers[agentID].DeregisterHandlers(); | ||
1499 | m_capsHandlers.Remove(agentID); | 1500 | m_capsHandlers.Remove(agentID); |
1500 | } | 1501 | } |
1501 | } | 1502 | } |