aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordiva2009-04-05 22:39:19 +0000
committerdiva2009-04-05 22:39:19 +0000
commit5b103aab896eef4ca8d538d12728fdc1929e34d1 (patch)
treea510fdbd101d377c40403bc44b085598e0ae71dd
parentunspecified sculpt stitching mode now defaults to plane instead of sphere. Ad... (diff)
downloadopensim-SC_OLD-5b103aab896eef4ca8d538d12728fdc1929e34d1.zip
opensim-SC_OLD-5b103aab896eef4ca8d538d12728fdc1929e34d1.tar.gz
opensim-SC_OLD-5b103aab896eef4ca8d538d12728fdc1929e34d1.tar.bz2
opensim-SC_OLD-5b103aab896eef4ca8d538d12728fdc1929e34d1.tar.xz
Changed the asynchronous call to get inventory in HG, so that it properly reports problems. OGS1 should also be changed, but I'm leaving it as is for now. RestSessionObjectPosterResponse is fairly broken and should not be used.
Minor changes in Get inventory item in HGAssetMapper.
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs68
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInterregionComms.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs35
3 files changed, 68 insertions, 41 deletions
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
index a2b2c84..5e3f229 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
@@ -81,30 +81,22 @@ namespace OpenSim.Region.Communications.Hypergrid
81 { 81 {
82 m_RequestingInventory.Add(userID, callback); 82 m_RequestingInventory.Add(userID, callback);
83 83
84 string invServer = GetUserInventoryURI(userID);
85 m_log.InfoFormat(
86 "[HGrid INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1} ({2})",
87 /*_inventoryServerUrl*/ invServer, userID, userID.Guid);
88
84 try 89 try
85 { 90 {
86 string invServer = GetUserInventoryURI(userID);
87 m_log.InfoFormat(
88 "[HGrid INVENTORY SERVICE]: Requesting inventory from {0}/GetInventory/ for user {1} ({2})",
89 /*_inventoryServerUrl*/ invServer, userID, userID.Guid);
90
91
92 RestSessionObjectPosterResponse<Guid, InventoryCollection> requester
93 = new RestSessionObjectPosterResponse<Guid, InventoryCollection>();
94 requester.ResponseCallback = InventoryResponse;
95 91
96 requester.BeginPostObject(invServer + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString()); 92 //RestSessionObjectPosterResponse<Guid, InventoryCollection> requester
97 93 // = new RestSessionObjectPosterResponse<Guid, InventoryCollection>();
98 //Test(userID.Guid);
99
100 //RestObjectPosterResponse<InventoryCollection> requester
101 // = new RestObjectPosterResponse<InventoryCollection>();
102 //requester.ResponseCallback = InventoryResponse; 94 //requester.ResponseCallback = InventoryResponse;
103 95
104 //requester.BeginPostObject<Guid>(/*_inventoryServerUrl*/ invServer + "/GetInventory/", userID.Guid); 96 //requester.BeginPostObject(invServer + "/GetInventory/", userID.Guid, session_id.ToString(), userID.ToString());
97 GetInventoryDelegate d = GetInventoryAsync;
98 d.BeginInvoke(invServer, userID, session_id, GetInventoryCompleted, d);
105 99
106 //RestClient cli = new RestClient(invServer + "/GetInventory/" + userID.Guid);
107 //Stream reply = cli.Request();
108 } 100 }
109 catch (WebException e) 101 catch (WebException e)
110 { 102 {
@@ -133,6 +125,44 @@ namespace OpenSim.Region.Communications.Hypergrid
133 125
134 } 126 }
135 127
128 private delegate InventoryCollection GetInventoryDelegate(string url, UUID userID, UUID sessionID);
129
130 protected InventoryCollection GetInventoryAsync(string url, UUID userID, UUID sessionID)
131 {
132 InventoryCollection icol = null;
133 try
134 {
135 icol = SynchronousRestSessionObjectPoster<Guid, InventoryCollection>.BeginPostObject("POST", url + "/GetInventory/",
136 userID.Guid, sessionID.ToString(), userID.ToString());
137
138 }
139 catch (Exception e)
140 {
141 m_log.Debug("[HGrid]: Exception getting users inventory: " + e.Message);
142 }
143 if (icol == null)
144 {
145 // Well, let's synthesize one
146 icol = new InventoryCollection();
147 icol.UserID = userID;
148 icol.Items = new List<InventoryItemBase>();
149 icol.Folders = new List<InventoryFolderBase>();
150 InventoryFolderBase rootFolder = new InventoryFolderBase();
151 rootFolder.ID = UUID.Random();
152 rootFolder.Owner = userID;
153 icol.Folders.Add(rootFolder);
154 }
155
156 return icol;
157 }
158
159 private void GetInventoryCompleted(IAsyncResult iar)
160 {
161 GetInventoryDelegate icon = (GetInventoryDelegate)iar.AsyncState;
162 InventoryCollection icol = icon.EndInvoke(iar);
163 InventoryResponse(icol);
164 }
165
136 /// <summary> 166 /// <summary>
137 /// Add a new folder to the user's inventory 167 /// Add a new folder to the user's inventory
138 /// </summary> 168 /// </summary>
@@ -460,9 +490,9 @@ namespace OpenSim.Region.Communications.Hypergrid
460 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID); 490 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Did not get back an inventory containing a root folder for user {0}", userID);
461 } 491 }
462 492
493 m_RequestingInventory.Remove(userID);
463 callback(folders, items); 494 callback(folders, items);
464 495
465 m_RequestingInventory.Remove(userID);
466 } 496 }
467 else 497 else
468 { 498 {
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
index b57b5ed..b5a9395 100644
--- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs
@@ -91,11 +91,11 @@ namespace OpenSim.Region.Framework.Interfaces
91 91
92 /// <summary> 92 /// <summary>
93 /// Create an object from the user's inventory in the destination region. 93 /// Create an object from the user's inventory in the destination region.
94 /// This message is used primarily for prim crossing. 94 /// This message is used primarily by clients.
95 /// </summary> 95 /// </summary>
96 /// <param name="regionHandle"></param> 96 /// <param name="regionHandle"></param>
97 /// <param name="sog"></param> 97 /// <param name="userID"></param>
98 /// <param name="isLocalCall"></param> 98 /// <param name="itemID"></param>
99 /// <returns></returns> 99 /// <returns></returns>
100 bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID); 100 bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID);
101 101
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index b192101..48ea519 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -333,29 +333,26 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
333 333
334 public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) 334 public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
335 { 335 {
336 if (!IsLocalUser(item.Owner)) 336 InventoryClient invCli = null;
337 string inventoryURL = UserInventoryURL(item.Owner);
338 if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
337 { 339 {
338 InventoryClient invCli = null; 340 m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
339 string inventoryURL = UserInventoryURL(item.Owner); 341 invCli = new InventoryClient(inventoryURL);
340 if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) 342 m_inventoryServers.Add(inventoryURL, invCli);
341 { 343 }
342 m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
343 invCli = new InventoryClient(inventoryURL);
344 m_inventoryServers.Add(inventoryURL, invCli);
345 }
346 344
347 item = invCli.GetInventoryItem(item); 345 item = invCli.GetInventoryItem(item);
348 if (item != null) 346 if (item != null)
347 {
348 // Change the folder, stick it in root folder, all items flattened out here in this region cache
349 item.Folder = rootFolder;
350 //userInfo.AddItem(item); don't use this, it calls back to the inventory server
351 lock (userInfo.RootFolder.Items)
349 { 352 {
350 // Change the folder, stick it in root folder, all items flattened out here in this region cache 353 userInfo.RootFolder.Items[item.ID] = item;
351 item.Folder = rootFolder;
352 //userInfo.AddItem(item); don't use this, it calls back to the inventory server
353 lock (userInfo.RootFolder.Items)
354 {
355 userInfo.RootFolder.Items[item.ID] = item;
356 }
357
358 } 354 }
355
359 } 356 }
360 return item; 357 return item;
361 } 358 }