diff options
author | Justin Clark-Casey (justincc) | 2011-11-25 22:46:42 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-11-25 22:46:42 +0000 |
commit | 676d32974adc913b2902db6cfa456c77bd52cd85 (patch) | |
tree | 267be739951c23848b00a50dd8e46027f4b0af72 /OpenSim/Region | |
parent | remove some mono compiler warnings (diff) | |
download | opensim-SC-676d32974adc913b2902db6cfa456c77bd52cd85.zip opensim-SC-676d32974adc913b2902db6cfa456c77bd52cd85.tar.gz opensim-SC-676d32974adc913b2902db6cfa456c77bd52cd85.tar.bz2 opensim-SC-676d32974adc913b2902db6cfa456c77bd52cd85.tar.xz |
Implement the FetchInventoryDescendents2 capability using the same code as WebFetchInventoryDescendents.
Enabling this by setting Cap_FetchInventoryDescendents2 = "localhost" in the [ClientStack.LindenCaps] section of OpenSim.ini downloads inventory via http rather than udp in later viewers.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 1c1d83c..2a41b87 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs | |||
@@ -42,18 +42,24 @@ using OpenSim.Capabilities.Handlers; | |||
42 | 42 | ||
43 | namespace OpenSim.Region.ClientStack.Linden | 43 | namespace OpenSim.Region.ClientStack.Linden |
44 | { | 44 | { |
45 | 45 | /// <summary> | |
46 | /// This module implements both WebFetchInventoryDescendents and FetchInventoryDescendents2 capabilities. | ||
47 | /// </summary> | ||
46 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
47 | public class WebFetchInvDescModule : INonSharedRegionModule | 49 | public class WebFetchInvDescModule : INonSharedRegionModule |
48 | { | 50 | { |
49 | private static readonly ILog m_log = | 51 | private static readonly ILog m_log = |
50 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | |||
51 | private Scene m_scene; | 54 | private Scene m_scene; |
52 | 55 | ||
53 | private IInventoryService m_InventoryService; | 56 | private IInventoryService m_InventoryService; |
54 | private ILibraryService m_LibraryService; | 57 | private ILibraryService m_LibraryService; |
55 | private bool m_Enabled = false; | 58 | |
56 | private string m_URL; | 59 | private bool m_Enabled; |
60 | |||
61 | private string m_fetchInventoryDescendents2Url; | ||
62 | private string m_webFetchInventoryDescendentsUrl; | ||
57 | 63 | ||
58 | #region ISharedRegionModule Members | 64 | #region ISharedRegionModule Members |
59 | 65 | ||
@@ -63,9 +69,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
63 | if (config == null) | 69 | if (config == null) |
64 | return; | 70 | return; |
65 | 71 | ||
66 | m_URL = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); | 72 | m_fetchInventoryDescendents2Url = config.GetString("Cap_FetchInventoryDescendents2", string.Empty); |
67 | // Cap doesn't exist | 73 | m_webFetchInventoryDescendentsUrl = config.GetString("Cap_WebFetchInventoryDescendents", string.Empty); |
68 | if (m_URL != string.Empty) | 74 | |
75 | if (m_fetchInventoryDescendents2Url != string.Empty || m_webFetchInventoryDescendentsUrl != string.Empty) | ||
69 | m_Enabled = true; | 76 | m_Enabled = true; |
70 | } | 77 | } |
71 | 78 | ||
@@ -111,26 +118,40 @@ namespace OpenSim.Region.ClientStack.Linden | |||
111 | 118 | ||
112 | #endregion | 119 | #endregion |
113 | 120 | ||
114 | public void RegisterCaps(UUID agentID, Caps caps) | 121 | private void RegisterCaps(UUID agentID, Caps caps) |
115 | { | 122 | { |
116 | UUID capID = UUID.Random(); | 123 | UUID capID = UUID.Random(); |
117 | 124 | ||
118 | //caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture)); | 125 | if (m_webFetchInventoryDescendentsUrl != "") |
119 | if (m_URL == "localhost") | 126 | RegisterFetchCap(agentID, caps, "WebFetchInventoryDescendents", m_webFetchInventoryDescendentsUrl); |
127 | else if (m_fetchInventoryDescendents2Url != "") | ||
128 | RegisterFetchCap(agentID, caps, "FetchInventoryDescendents2", m_fetchInventoryDescendents2Url); | ||
129 | } | ||
130 | |||
131 | private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) | ||
132 | { | ||
133 | string capUrl; | ||
134 | |||
135 | if (url == "localhost") | ||
120 | { | 136 | { |
121 | m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName); | 137 | capUrl = "/CAPS/" + UUID.Random(); |
138 | |||
122 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | 139 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); |
123 | IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/" + UUID.Random(), webFetchHandler.FetchInventoryDescendentsRequest); | 140 | IRequestHandler reqHandler |
124 | caps.RegisterHandler("WebFetchInventoryDescendents", reqHandler); | 141 | = new RestStreamHandler("POST", capUrl, webFetchHandler.FetchInventoryDescendentsRequest); |
125 | // caps.RegisterHandler("FetchInventoryDescendents2", reqHandler); | 142 | |
143 | caps.RegisterHandler(capName, reqHandler); | ||
126 | } | 144 | } |
127 | else | 145 | else |
128 | { | 146 | { |
129 | m_log.InfoFormat("[WEBFETCHINVENTORYDESCENDANTS]: {0} in region {1}", m_URL, m_scene.RegionInfo.RegionName); | 147 | capUrl = url; |
130 | caps.RegisterHandler("WebFetchInventoryDescendents", m_URL); | 148 | |
131 | // caps.RegisterHandler("FetchInventoryDescendents2", m_URL); | 149 | caps.RegisterHandler(capName, capUrl); |
132 | } | 150 | } |
133 | } | ||
134 | 151 | ||
152 | // m_log.DebugFormat( | ||
153 | // "[WEB FETCH INV DESC MODULE]: Registered capability {0} at {1} in region {2} for {3}", | ||
154 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | ||
155 | } | ||
135 | } | 156 | } |
136 | } | 157 | } |