aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Hypergrid
diff options
context:
space:
mode:
authordiva2009-04-05 22:39:19 +0000
committerdiva2009-04-05 22:39:19 +0000
commit5b103aab896eef4ca8d538d12728fdc1929e34d1 (patch)
treea510fdbd101d377c40403bc44b085598e0ae71dd /OpenSim/Region/Communications/Hypergrid
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.
Diffstat (limited to 'OpenSim/Region/Communications/Hypergrid')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs68
1 files changed, 49 insertions, 19 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 {