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 | |
parent | remove some mono compiler warnings (diff) | |
download | opensim-SC_OLD-676d32974adc913b2902db6cfa456c77bd52cd85.zip opensim-SC_OLD-676d32974adc913b2902db6cfa456c77bd52cd85.tar.gz opensim-SC_OLD-676d32974adc913b2902db6cfa456c77bd52cd85.tar.bz2 opensim-SC_OLD-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.
3 files changed, 46 insertions, 22 deletions
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index 52b5f2c..04fa55c 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | |||
@@ -117,7 +117,6 @@ namespace OpenSim.Capabilities.Handlers | |||
117 | response += inventoryitemstr; | 117 | response += inventoryitemstr; |
118 | } | 118 | } |
119 | 119 | ||
120 | |||
121 | if (response.Length == 0) | 120 | if (response.Length == 0) |
122 | { | 121 | { |
123 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. | 122 | // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. |
@@ -135,6 +134,7 @@ namespace OpenSim.Capabilities.Handlers | |||
135 | //m_log.Debug("[CAPS] "+response); | 134 | //m_log.Debug("[CAPS] "+response); |
136 | 135 | ||
137 | } | 136 | } |
137 | |||
138 | return response; | 138 | return response; |
139 | } | 139 | } |
140 | 140 | ||
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 | } |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index ebd734d..972efe4 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -573,11 +573,14 @@ | |||
573 | Cap_UploadObjectAsset = "localhost" | 573 | Cap_UploadObjectAsset = "localhost" |
574 | Cap_ViewerStartAuction = "" | 574 | Cap_ViewerStartAuction = "" |
575 | Cap_ViewerStats = "" | 575 | Cap_ViewerStats = "" |
576 | ; This last one is supported by OpenSim, but may | ||
577 | ; lead to poor sim performance if served by the simulators, | ||
578 | ; so it is disabled by default. | ||
579 | Cap_WebFetchInventoryDescendents = "" | ||
580 | 576 | ||
577 | ; The fetch inventory descendents caps are supported by OpenSim, but may | ||
578 | ; lead to poor sim performance if served by the simulators, | ||
579 | ; so they are disabled by default. | ||
580 | ; FetchInventoryDescendents2 is the one used in the latest Linden Lab viewers (from some point in the v2 series and above) | ||
581 | Cap_WebFetchInventoryDescendents = "" | ||
582 | Cap_FetchInventoryDescendents2 = "" | ||
583 | |||
581 | 584 | ||
582 | [Chat] | 585 | [Chat] |
583 | ; Controls whether the chat module is enabled. Default is true. | 586 | ; Controls whether the chat module is enabled. Default is true. |