diff options
Diffstat (limited to 'OpenSim/Services/Connectors')
15 files changed, 470 insertions, 117 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2b2f11f..4b502b7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -27,9 +27,11 @@ | |||
27 | 27 | ||
28 | using log4net; | 28 | using log4net; |
29 | using System; | 29 | using System; |
30 | using System.Threading; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.IO; | 32 | using System.IO; |
32 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Timers; | ||
33 | using Nini.Config; | 35 | using Nini.Config; |
34 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
@@ -47,14 +49,22 @@ namespace OpenSim.Services.Connectors | |||
47 | 49 | ||
48 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
49 | private IImprovedAssetCache m_Cache = null; | 51 | private IImprovedAssetCache m_Cache = null; |
52 | private int m_retryCounter; | ||
53 | private Dictionary<int, List<AssetBase>> m_retryQueue = new Dictionary<int, List<AssetBase>>(); | ||
54 | private System.Timers.Timer m_retryTimer; | ||
50 | private int m_maxAssetRequestConcurrency = 30; | 55 | private int m_maxAssetRequestConcurrency = 30; |
51 | 56 | ||
52 | private delegate void AssetRetrievedEx(AssetBase asset); | 57 | private delegate void AssetRetrievedEx(AssetBase asset); |
53 | 58 | ||
54 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. | 59 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. |
55 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded | 60 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded |
56 | private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); | 61 | // private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); |
57 | 62 | ||
63 | private Dictionary<string, List<AssetRetrievedEx>> m_AssetHandlers = new Dictionary<string, List<AssetRetrievedEx>>(); | ||
64 | |||
65 | private Dictionary<string, string> m_UriMap = new Dictionary<string, string>(); | ||
66 | |||
67 | private Thread[] m_fetchThreads; | ||
58 | 68 | ||
59 | public AssetServicesConnector() | 69 | public AssetServicesConnector() |
60 | { | 70 | { |
@@ -86,13 +96,102 @@ namespace OpenSim.Services.Connectors | |||
86 | string serviceURI = assetConfig.GetString("AssetServerURI", | 96 | string serviceURI = assetConfig.GetString("AssetServerURI", |
87 | String.Empty); | 97 | String.Empty); |
88 | 98 | ||
99 | m_ServerURI = serviceURI; | ||
100 | |||
89 | if (serviceURI == String.Empty) | 101 | if (serviceURI == String.Empty) |
90 | { | 102 | { |
91 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); | 103 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); |
92 | throw new Exception("Asset connector init error"); | 104 | throw new Exception("Asset connector init error"); |
93 | } | 105 | } |
94 | 106 | ||
95 | m_ServerURI = serviceURI; | 107 | |
108 | m_retryTimer = new System.Timers.Timer(); | ||
109 | m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); | ||
110 | m_retryTimer.Interval = 60000; | ||
111 | |||
112 | Uri serverUri = new Uri(m_ServerURI); | ||
113 | |||
114 | string groupHost = serverUri.Host; | ||
115 | |||
116 | for (int i = 0 ; i < 256 ; i++) | ||
117 | { | ||
118 | string prefix = i.ToString("x2"); | ||
119 | groupHost = assetConfig.GetString("AssetServerHost_"+prefix, groupHost); | ||
120 | |||
121 | m_UriMap[prefix] = groupHost; | ||
122 | //m_log.DebugFormat("[ASSET]: Using {0} for prefix {1}", groupHost, prefix); | ||
123 | } | ||
124 | |||
125 | m_fetchThreads = new Thread[2]; | ||
126 | |||
127 | for (int i = 0 ; i < 2 ; i++) | ||
128 | { | ||
129 | m_fetchThreads[i] = new Thread(AssetRequestProcessor); | ||
130 | m_fetchThreads[i].Start(); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | private string MapServer(string id) | ||
135 | { | ||
136 | UriBuilder serverUri = new UriBuilder(m_ServerURI); | ||
137 | |||
138 | string prefix = id.Substring(0, 2).ToLower(); | ||
139 | |||
140 | string host = m_UriMap[prefix]; | ||
141 | |||
142 | serverUri.Host = host; | ||
143 | |||
144 | // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); | ||
145 | |||
146 | string ret = serverUri.Uri.AbsoluteUri; | ||
147 | if (ret.EndsWith("/")) | ||
148 | ret = ret.Substring(0, ret.Length - 1); | ||
149 | return ret; | ||
150 | } | ||
151 | |||
152 | protected void retryCheck(object source, ElapsedEventArgs e) | ||
153 | { | ||
154 | m_retryCounter++; | ||
155 | if (m_retryCounter > 60) m_retryCounter -= 60; | ||
156 | List<int> keys = new List<int>(); | ||
157 | foreach (int a in m_retryQueue.Keys) | ||
158 | { | ||
159 | keys.Add(a); | ||
160 | } | ||
161 | foreach (int a in keys) | ||
162 | { | ||
163 | //We exponentially fall back on frequency until we reach one attempt per hour | ||
164 | //The net result is that we end up in the queue for roughly 24 hours.. | ||
165 | //24 hours worth of assets could be a lot, so the hope is that the region admin | ||
166 | //will have gotten the asset connector back online quickly! | ||
167 | |||
168 | int timefactor = a ^ 2; | ||
169 | if (timefactor > 60) | ||
170 | { | ||
171 | timefactor = 60; | ||
172 | } | ||
173 | |||
174 | //First, find out if we care about this timefactor | ||
175 | if (timefactor % a == 0) | ||
176 | { | ||
177 | //Yes, we do! | ||
178 | List<AssetBase> retrylist = m_retryQueue[a]; | ||
179 | m_retryQueue.Remove(a); | ||
180 | |||
181 | foreach(AssetBase ass in retrylist) | ||
182 | { | ||
183 | Store(ass); //Store my ass. This function will put it back in the dictionary if it fails | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | if (m_retryQueue.Count == 0) | ||
189 | { | ||
190 | //It might only be one tick per minute, but I have | ||
191 | //repented and abandoned my wasteful ways | ||
192 | m_retryCounter = 0; | ||
193 | m_retryTimer.Stop(); | ||
194 | } | ||
96 | } | 195 | } |
97 | 196 | ||
98 | protected void SetCache(IImprovedAssetCache cache) | 197 | protected void SetCache(IImprovedAssetCache cache) |
@@ -102,15 +201,13 @@ namespace OpenSim.Services.Connectors | |||
102 | 201 | ||
103 | public AssetBase Get(string id) | 202 | public AssetBase Get(string id) |
104 | { | 203 | { |
105 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); | 204 | string uri = MapServer(id) + "/assets/" + id; |
106 | |||
107 | string uri = m_ServerURI + "/assets/" + id; | ||
108 | 205 | ||
109 | AssetBase asset = null; | 206 | AssetBase asset = null; |
110 | if (m_Cache != null) | 207 | if (m_Cache != null) |
111 | asset = m_Cache.Get(id); | 208 | asset = m_Cache.Get(id); |
112 | 209 | ||
113 | if (asset == null) | 210 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
114 | { | 211 | { |
115 | asset = SynchronousRestObjectRequester. | 212 | asset = SynchronousRestObjectRequester. |
116 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); | 213 | MakeRequest<int, AssetBase>("GET", uri, 0, m_maxAssetRequestConcurrency); |
@@ -141,7 +238,7 @@ namespace OpenSim.Services.Connectors | |||
141 | return fullAsset.Metadata; | 238 | return fullAsset.Metadata; |
142 | } | 239 | } |
143 | 240 | ||
144 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 241 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; |
145 | 242 | ||
146 | AssetMetadata asset = SynchronousRestObjectRequester. | 243 | AssetMetadata asset = SynchronousRestObjectRequester. |
147 | MakeRequest<int, AssetMetadata>("GET", uri, 0); | 244 | MakeRequest<int, AssetMetadata>("GET", uri, 0); |
@@ -158,7 +255,7 @@ namespace OpenSim.Services.Connectors | |||
158 | return fullAsset.Data; | 255 | return fullAsset.Data; |
159 | } | 256 | } |
160 | 257 | ||
161 | RestClient rc = new RestClient(m_ServerURI); | 258 | RestClient rc = new RestClient(MapServer(id)); |
162 | rc.AddResourcePath("assets"); | 259 | rc.AddResourcePath("assets"); |
163 | rc.AddResourcePath(id); | 260 | rc.AddResourcePath(id); |
164 | rc.AddResourcePath("data"); | 261 | rc.AddResourcePath("data"); |
@@ -181,66 +278,109 @@ namespace OpenSim.Services.Connectors | |||
181 | return null; | 278 | return null; |
182 | } | 279 | } |
183 | 280 | ||
184 | public bool Get(string id, Object sender, AssetRetrieved handler) | 281 | private class QueuedAssetRequest |
185 | { | 282 | { |
186 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); | 283 | public string uri; |
284 | public string id; | ||
285 | } | ||
187 | 286 | ||
188 | string uri = m_ServerURI + "/assets/" + id; | 287 | private OpenMetaverse.BlockingQueue<QueuedAssetRequest> m_requestQueue = |
288 | new OpenMetaverse.BlockingQueue<QueuedAssetRequest>(); | ||
189 | 289 | ||
190 | AssetBase asset = null; | 290 | private void AssetRequestProcessor() |
191 | if (m_Cache != null) | 291 | { |
192 | asset = m_Cache.Get(id); | 292 | QueuedAssetRequest r; |
193 | 293 | ||
194 | if (asset == null) | 294 | while (true) |
195 | { | 295 | { |
196 | lock (m_AssetHandlers) | 296 | r = m_requestQueue.Dequeue(); |
197 | { | ||
198 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
199 | |||
200 | AssetRetrievedEx handlers; | ||
201 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | ||
202 | { | ||
203 | // Someone else is already loading this asset. It will notify our handler when done. | ||
204 | handlers += handlerEx; | ||
205 | return true; | ||
206 | } | ||
207 | 297 | ||
208 | // Load the asset ourselves | 298 | string uri = r.uri; |
209 | handlers += handlerEx; | 299 | string id = r.id; |
210 | m_AssetHandlers.Add(id, handlers); | ||
211 | } | ||
212 | 300 | ||
213 | bool success = false; | 301 | bool success = false; |
214 | try | 302 | try |
215 | { | 303 | { |
216 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, | 304 | AssetBase a = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, 30); |
217 | delegate(AssetBase a) | 305 | if (a != null) |
218 | { | 306 | { |
219 | if (m_Cache != null) | 307 | if (m_Cache != null) |
220 | m_Cache.Cache(a); | 308 | m_Cache.Cache(a); |
221 | 309 | ||
222 | AssetRetrievedEx handlers; | 310 | List<AssetRetrievedEx> handlers; |
223 | lock (m_AssetHandlers) | 311 | lock (m_AssetHandlers) |
312 | { | ||
313 | handlers = m_AssetHandlers[id]; | ||
314 | m_AssetHandlers.Remove(id); | ||
315 | } | ||
316 | foreach (AssetRetrievedEx h in handlers) | ||
317 | { | ||
318 | Util.FireAndForget(x => | ||
224 | { | 319 | { |
225 | handlers = m_AssetHandlers[id]; | 320 | h.Invoke(a); |
226 | m_AssetHandlers.Remove(id); | 321 | }); |
227 | } | 322 | } |
228 | handlers.Invoke(a); | 323 | if (handlers != null) |
229 | }, m_maxAssetRequestConcurrency); | 324 | handlers.Clear(); |
230 | 325 | ||
231 | success = true; | 326 | success = true; |
327 | } | ||
232 | } | 328 | } |
233 | finally | 329 | finally |
234 | { | 330 | { |
235 | if (!success) | 331 | if (!success) |
236 | { | 332 | { |
333 | List<AssetRetrievedEx> handlers; | ||
237 | lock (m_AssetHandlers) | 334 | lock (m_AssetHandlers) |
238 | { | 335 | { |
336 | handlers = m_AssetHandlers[id]; | ||
239 | m_AssetHandlers.Remove(id); | 337 | m_AssetHandlers.Remove(id); |
240 | } | 338 | } |
339 | if (handlers != null) | ||
340 | handlers.Clear(); | ||
241 | } | 341 | } |
242 | } | 342 | } |
243 | } | 343 | } |
344 | } | ||
345 | |||
346 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
347 | { | ||
348 | string uri = MapServer(id) + "/assets/" + id; | ||
349 | |||
350 | AssetBase asset = null; | ||
351 | if (m_Cache != null) | ||
352 | asset = m_Cache.Get(id); | ||
353 | |||
354 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | ||
355 | { | ||
356 | lock (m_AssetHandlers) | ||
357 | { | ||
358 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
359 | |||
360 | // AssetRetrievedEx handlers; | ||
361 | List<AssetRetrievedEx> handlers; | ||
362 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | ||
363 | { | ||
364 | // Someone else is already loading this asset. It will notify our handler when done. | ||
365 | // handlers += handlerEx; | ||
366 | handlers.Add(handlerEx); | ||
367 | return true; | ||
368 | } | ||
369 | |||
370 | // Load the asset ourselves | ||
371 | // handlers += handlerEx; | ||
372 | handlers = new List<AssetRetrievedEx>(); | ||
373 | handlers.Add(handlerEx); | ||
374 | |||
375 | m_AssetHandlers.Add(id, handlers); | ||
376 | } | ||
377 | |||
378 | QueuedAssetRequest request = new QueuedAssetRequest(); | ||
379 | request.id = id; | ||
380 | request.uri = uri; | ||
381 | |||
382 | m_requestQueue.Enqueue(request); | ||
383 | } | ||
244 | else | 384 | else |
245 | { | 385 | { |
246 | handler(id, sender, asset); | 386 | handler(id, sender, asset); |
@@ -251,38 +391,95 @@ namespace OpenSim.Services.Connectors | |||
251 | 391 | ||
252 | public string Store(AssetBase asset) | 392 | public string Store(AssetBase asset) |
253 | { | 393 | { |
254 | if (asset.Temporary || asset.Local) | 394 | // Have to assign the asset ID here. This isn't likely to |
395 | // trigger since current callers don't pass emtpy IDs | ||
396 | // We need the asset ID to route the request to the proper | ||
397 | // cluster member, so we can't have the server assign one. | ||
398 | if (asset.ID == string.Empty) | ||
255 | { | 399 | { |
256 | if (m_Cache != null) | 400 | if (asset.FullID == UUID.Zero) |
257 | m_Cache.Cache(asset); | 401 | { |
402 | asset.FullID = UUID.Random(); | ||
403 | } | ||
404 | asset.ID = asset.FullID.ToString(); | ||
405 | } | ||
406 | else if (asset.FullID == UUID.Zero) | ||
407 | { | ||
408 | UUID uuid = UUID.Zero; | ||
409 | if (UUID.TryParse(asset.ID, out uuid)) | ||
410 | { | ||
411 | asset.FullID = uuid; | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | asset.FullID = UUID.Random(); | ||
416 | } | ||
417 | } | ||
258 | 418 | ||
419 | if (m_Cache != null) | ||
420 | m_Cache.Cache(asset); | ||
421 | if (asset.Temporary || asset.Local) | ||
422 | { | ||
259 | return asset.ID; | 423 | return asset.ID; |
260 | } | 424 | } |
261 | 425 | ||
262 | string uri = m_ServerURI + "/assets/"; | 426 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
263 | 427 | ||
264 | string newID = string.Empty; | 428 | string newID = string.Empty; |
265 | try | 429 | try |
266 | { | 430 | { |
267 | newID = SynchronousRestObjectRequester. | 431 | newID = SynchronousRestObjectRequester. |
268 | MakeRequest<AssetBase, string>("POST", uri, asset); | 432 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); |
433 | if (newID == null || newID == "") | ||
434 | { | ||
435 | newID = UUID.Zero.ToString(); | ||
436 | } | ||
269 | } | 437 | } |
270 | catch (Exception e) | 438 | catch (Exception e) |
271 | { | 439 | { |
272 | m_log.WarnFormat("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1}", asset.ID, e.Message); | 440 | newID = UUID.Zero.ToString(); |
273 | } | 441 | } |
274 | 442 | ||
275 | if (newID != String.Empty) | 443 | if (newID == UUID.Zero.ToString()) |
444 | { | ||
445 | //The asset upload failed, put it in a queue for later | ||
446 | asset.UploadAttempts++; | ||
447 | if (asset.UploadAttempts > 30) | ||
448 | { | ||
449 | //By this stage we've been in the queue for a good few hours; | ||
450 | //We're going to drop the asset. | ||
451 | m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString()); | ||
452 | } | ||
453 | else | ||
454 | { | ||
455 | if (!m_retryQueue.ContainsKey(asset.UploadAttempts)) | ||
456 | { | ||
457 | m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>()); | ||
458 | } | ||
459 | List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts]; | ||
460 | m_queue.Add(asset); | ||
461 | m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString()); | ||
462 | m_retryTimer.Start(); | ||
463 | } | ||
464 | } | ||
465 | else | ||
276 | { | 466 | { |
277 | // Placing this here, so that this work with old asset servers that don't send any reply back | 467 | if (asset.UploadAttempts > 0) |
278 | // SynchronousRestObjectRequester returns somethins that is not an empty string | 468 | { |
279 | if (newID != null) | 469 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); |
280 | asset.ID = newID; | 470 | } |
471 | if (newID != String.Empty) | ||
472 | { | ||
473 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
474 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
475 | if (newID != null) | ||
476 | asset.ID = newID; | ||
281 | 477 | ||
282 | if (m_Cache != null) | 478 | if (m_Cache != null) |
283 | m_Cache.Cache(asset); | 479 | m_Cache.Cache(asset); |
480 | } | ||
284 | } | 481 | } |
285 | return newID; | 482 | return asset.ID; |
286 | } | 483 | } |
287 | 484 | ||
288 | public bool UpdateContent(string id, byte[] data) | 485 | public bool UpdateContent(string id, byte[] data) |
@@ -303,7 +500,7 @@ namespace OpenSim.Services.Connectors | |||
303 | } | 500 | } |
304 | asset.Data = data; | 501 | asset.Data = data; |
305 | 502 | ||
306 | string uri = m_ServerURI + "/assets/" + id; | 503 | string uri = MapServer(id) + "/assets/" + id; |
307 | 504 | ||
308 | if (SynchronousRestObjectRequester. | 505 | if (SynchronousRestObjectRequester. |
309 | MakeRequest<AssetBase, bool>("POST", uri, asset)) | 506 | MakeRequest<AssetBase, bool>("POST", uri, asset)) |
@@ -318,7 +515,7 @@ namespace OpenSim.Services.Connectors | |||
318 | 515 | ||
319 | public bool Delete(string id) | 516 | public bool Delete(string id) |
320 | { | 517 | { |
321 | string uri = m_ServerURI + "/assets/" + id; | 518 | string uri = MapServer(id) + "/assets/" + id; |
322 | 519 | ||
323 | if (SynchronousRestObjectRequester. | 520 | if (SynchronousRestObjectRequester. |
324 | MakeRequest<int, bool>("DELETE", uri, 0)) | 521 | MakeRequest<int, bool>("DELETE", uri, 0)) |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index 2b77154..f996aca 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -81,6 +81,13 @@ namespace OpenSim.Services.Connectors | |||
81 | m_ServerURI = serviceURI; | 81 | m_ServerURI = serviceURI; |
82 | } | 82 | } |
83 | 83 | ||
84 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
85 | { | ||
86 | realID = UUID.Zero; | ||
87 | |||
88 | return Authenticate(principalID, password, lifetime); | ||
89 | } | ||
90 | |||
84 | public string Authenticate(UUID principalID, string password, int lifetime) | 91 | public string Authenticate(UUID principalID, string password, int lifetime) |
85 | { | 92 | { |
86 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 93 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index 6d5ce4b..45f4514 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs | |||
@@ -144,44 +144,48 @@ namespace OpenSim.Services.Connectors.Friends | |||
144 | 144 | ||
145 | private bool Call(GridRegion region, Dictionary<string, object> sendData) | 145 | private bool Call(GridRegion region, Dictionary<string, object> sendData) |
146 | { | 146 | { |
147 | string reqString = ServerUtils.BuildQueryString(sendData); | 147 | Util.FireAndForget(x => { |
148 | //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); | 148 | string reqString = ServerUtils.BuildQueryString(sendData); |
149 | if (region == null) | 149 | //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); |
150 | return false; | 150 | if (region == null) |
151 | 151 | return; | |
152 | string path = ServicePath(); | 152 | |
153 | if (!region.ServerURI.EndsWith("/")) | 153 | string path = ServicePath(); |
154 | path = "/" + path; | 154 | if (!region.ServerURI.EndsWith("/")) |
155 | string uri = region.ServerURI + path; | 155 | path = "/" + path; |
156 | // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); | 156 | string uri = region.ServerURI + path; |
157 | 157 | // m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); | |
158 | try | 158 | |
159 | { | 159 | try |
160 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); | ||
161 | if (reply != string.Empty) | ||
162 | { | 160 | { |
163 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 161 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); |
164 | 162 | if (reply != string.Empty) | |
165 | if (replyData.ContainsKey("RESULT")) | ||
166 | { | 163 | { |
167 | if (replyData["RESULT"].ToString().ToLower() == "true") | 164 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
168 | return true; | 165 | |
166 | if (replyData.ContainsKey("RESULT")) | ||
167 | { | ||
168 | // if (replyData["RESULT"].ToString().ToLower() == "true") | ||
169 | // return; | ||
170 | // else | ||
171 | return; | ||
172 | } | ||
169 | else | 173 | else |
170 | return false; | 174 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); |
175 | |||
171 | } | 176 | } |
172 | else | 177 | else |
173 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); | 178 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); |
174 | 179 | } | |
180 | catch (Exception e) | ||
181 | { | ||
182 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); | ||
175 | } | 183 | } |
176 | else | 184 | |
177 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); | 185 | return; |
178 | } | 186 | }); |
179 | catch (Exception e) | 187 | |
180 | { | 188 | return true; |
181 | m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); | ||
182 | } | ||
183 | |||
184 | return false; | ||
185 | } | 189 | } |
186 | } | 190 | } |
187 | } | 191 | } |
diff --git a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs index 34ed0d7..f982cc1 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors | |||
48 | 48 | ||
49 | private string m_ServerURI = String.Empty; | 49 | private string m_ServerURI = String.Empty; |
50 | 50 | ||
51 | private ExpiringCache<ulong, GridRegion> m_regionCache = | ||
52 | new ExpiringCache<ulong, GridRegion>(); | ||
53 | |||
51 | public GridServicesConnector() | 54 | public GridServicesConnector() |
52 | { | 55 | { |
53 | } | 56 | } |
@@ -272,6 +275,11 @@ namespace OpenSim.Services.Connectors | |||
272 | 275 | ||
273 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 276 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
274 | { | 277 | { |
278 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
279 | |||
280 | if (m_regionCache.Contains(regionHandle)) | ||
281 | return (GridRegion)m_regionCache[regionHandle]; | ||
282 | |||
275 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 283 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
276 | 284 | ||
277 | sendData["SCOPEID"] = scopeID.ToString(); | 285 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -313,6 +321,8 @@ namespace OpenSim.Services.Connectors | |||
313 | else | 321 | else |
314 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 322 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
315 | 323 | ||
324 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
325 | |||
316 | return rinfo; | 326 | return rinfo; |
317 | } | 327 | } |
318 | 328 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 5bcff48..d840527 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -158,6 +158,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
158 | try | 158 | try |
159 | { | 159 | { |
160 | WebClient c = new WebClient(); | 160 | WebClient c = new WebClient(); |
161 | //m_log.Debug("JPEG: " + imageURL); | ||
161 | string name = regionID.ToString(); | 162 | string name = regionID.ToString(); |
162 | filename = Path.Combine(storagePath, name + ".jpg"); | 163 | filename = Path.Combine(storagePath, name + ".jpg"); |
163 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); | 164 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); |
@@ -186,11 +187,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
186 | 187 | ||
187 | ass.Data = imageData; | 188 | ass.Data = imageData; |
188 | 189 | ||
189 | mapTile = ass.FullID; | ||
190 | |||
191 | // finally | ||
192 | m_AssetService.Store(ass); | 190 | m_AssetService.Store(ass); |
193 | 191 | ||
192 | // finally | ||
193 | mapTile = ass.FullID; | ||
194 | } | 194 | } |
195 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke | 195 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke |
196 | { | 196 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 47d0cce..d7e38f1 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -98,8 +98,6 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
98 | throw new Exception("UserAgent connector init error"); | 98 | throw new Exception("UserAgent connector init error"); |
99 | } | 99 | } |
100 | m_ServerURL = serviceURI; | 100 | m_ServerURL = serviceURI; |
101 | if (!m_ServerURL.EndsWith("/")) | ||
102 | m_ServerURL += "/"; | ||
103 | 101 | ||
104 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); | 102 | m_log.DebugFormat("[USER AGENT CONNECTOR]: UserAgentServiceConnector started for {0}", m_ServerURL); |
105 | } | 103 | } |
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 30a73a4..833e22a 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs | |||
@@ -130,4 +130,4 @@ namespace OpenSim.Services.Connectors | |||
130 | return landData; | 130 | return landData; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } \ No newline at end of file | 133 | } |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 5948380..b36fa23 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -153,9 +153,9 @@ namespace OpenSim.Services.Connectors | |||
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception e) |
155 | { | 155 | { |
156 | m_log.WarnFormat( | 156 | // m_log.WarnFormat( |
157 | "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", | 157 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", |
158 | thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | 158 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); |
159 | 159 | ||
160 | return false; | 160 | return false; |
161 | } | 161 | } |
@@ -202,4 +202,4 @@ namespace OpenSim.Services.Connectors | |||
202 | return true; | 202 | return true; |
203 | } | 203 | } |
204 | } | 204 | } |
205 | } \ No newline at end of file | 205 | } |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index f7d8c53..378aab6 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -304,6 +304,17 @@ namespace OpenSim.Services.Connectors | |||
304 | { | 304 | { |
305 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | 305 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); |
306 | } | 306 | } |
307 | else | ||
308 | { | ||
309 | if (replyData["result"].ToString() == "null") | ||
310 | return null; | ||
311 | |||
312 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
313 | } | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
307 | } | 318 | } |
308 | 319 | ||
309 | return pinfo; | 320 | return pinfo; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 6603f6e..03b19ae 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs | |||
@@ -102,6 +102,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); | 102 | m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); |
103 | } | 103 | } |
104 | 104 | ||
105 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
106 | { | ||
107 | realID = UUID.Zero; | ||
108 | return Authenticate(principalID, password, lifetime); | ||
109 | } | ||
110 | |||
105 | public string Authenticate(UUID principalID, string password, int lifetime) | 111 | public string Authenticate(UUID principalID, string password, int lifetime) |
106 | { | 112 | { |
107 | NameValueCollection requestArgs = new NameValueCollection | 113 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 038a4bf..20eaa3a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.Drawing; | ||
32 | using System.Drawing.Imaging; | ||
31 | using System.IO; | 33 | using System.IO; |
32 | using System.Net; | 34 | using System.Net; |
33 | using System.Reflection; | 35 | using System.Reflection; |
@@ -100,6 +102,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
100 | 102 | ||
101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | 103 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) |
102 | { | 104 | { |
105 | IPEndPoint ext = regionInfo.ExternalEndPoint; | ||
106 | if (ext == null) return "Region registration for " + regionInfo.RegionName + " failed: Could not resolve EndPoint"; | ||
107 | // Generate and upload our map tile in PNG format to the SimianGrid AddMapTile service | ||
108 | // Scene scene; | ||
109 | // if (m_scenes.TryGetValue(regionInfo.RegionID, out scene)) | ||
110 | // UploadMapTile(scene); | ||
111 | // else | ||
112 | // m_log.Warn("Registering region " + regionInfo.RegionName + " (" + regionInfo.RegionID + ") that we are not tracking"); | ||
113 | |||
103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 114 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
104 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); | 115 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); |
105 | 116 | ||
@@ -108,7 +119,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
108 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, | 119 | { "ServerURI", OSD.FromString(regionInfo.ServerURI) }, |
109 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, | 120 | { "InternalAddress", OSD.FromString(regionInfo.InternalEndPoint.Address.ToString()) }, |
110 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, | 121 | { "InternalPort", OSD.FromInteger(regionInfo.InternalEndPoint.Port) }, |
111 | { "ExternalAddress", OSD.FromString(regionInfo.ExternalEndPoint.Address.ToString()) }, | 122 | { "ExternalAddress", OSD.FromString(ext.Address.ToString()) }, |
112 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, | 123 | { "ExternalPort", OSD.FromInteger(regionInfo.ExternalEndPoint.Port) }, |
113 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, | 124 | { "MapTexture", OSD.FromUUID(regionInfo.TerrainImage) }, |
114 | { "Access", OSD.FromInteger(regionInfo.Access) }, | 125 | { "Access", OSD.FromInteger(regionInfo.Access) }, |
@@ -399,6 +410,83 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
399 | 410 | ||
400 | #endregion IGridService | 411 | #endregion IGridService |
401 | 412 | ||
413 | private void UploadMapTile(IScene scene) | ||
414 | { | ||
415 | string errorMessage = null; | ||
416 | |||
417 | // Create a PNG map tile and upload it to the AddMapTile API | ||
418 | byte[] pngData = Utils.EmptyBytes; | ||
419 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | ||
420 | if (tileGenerator == null) | ||
421 | { | ||
422 | m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator"); | ||
423 | return; | ||
424 | } | ||
425 | |||
426 | using (Image mapTile = tileGenerator.CreateMapTile()) | ||
427 | { | ||
428 | using (MemoryStream stream = new MemoryStream()) | ||
429 | { | ||
430 | mapTile.Save(stream, ImageFormat.Png); | ||
431 | pngData = stream.ToArray(); | ||
432 | } | ||
433 | } | ||
434 | |||
435 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
436 | { | ||
437 | new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
438 | new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
439 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
440 | }; | ||
441 | |||
442 | // Make the remote storage request | ||
443 | try | ||
444 | { | ||
445 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | ||
446 | |||
447 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
448 | using (Stream responseStream = response.GetResponseStream()) | ||
449 | { | ||
450 | string responseStr = null; | ||
451 | |||
452 | try | ||
453 | { | ||
454 | responseStr = responseStream.GetStreamString(); | ||
455 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
456 | if (responseOSD.Type == OSDType.Map) | ||
457 | { | ||
458 | OSDMap responseMap = (OSDMap)responseOSD; | ||
459 | if (responseMap["Success"].AsBoolean()) | ||
460 | m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile"); | ||
461 | else | ||
462 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
463 | } | ||
464 | else | ||
465 | { | ||
466 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
467 | } | ||
468 | } | ||
469 | catch (Exception ex) | ||
470 | { | ||
471 | if (!String.IsNullOrEmpty(responseStr)) | ||
472 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
473 | else | ||
474 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
475 | } | ||
476 | } | ||
477 | } | ||
478 | catch (WebException ex) | ||
479 | { | ||
480 | errorMessage = ex.Message; | ||
481 | } | ||
482 | |||
483 | if (!String.IsNullOrEmpty(errorMessage)) | ||
484 | { | ||
485 | m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}", | ||
486 | pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' ')); | ||
487 | } | ||
488 | } | ||
489 | |||
402 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) | 490 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) |
403 | { | 491 | { |
404 | NameValueCollection requestArgs = new NameValueCollection | 492 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 6e32b3a..fcb5115 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
195 | { | ||
196 | return null; | ||
197 | } | ||
198 | |||
194 | public bool StoreUserAccount(UserAccount data) | 199 | public bool StoreUserAccount(UserAccount data) |
195 | { | 200 | { |
196 | // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); | 201 | // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index 504fcaf..96c02d9 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs | |||
@@ -164,6 +164,11 @@ namespace OpenSim.Services.Connectors | |||
164 | m_database.RemoveRegionEnvironmentSettings(regionUUID); | 164 | m_database.RemoveRegionEnvironmentSettings(regionUUID); |
165 | } | 165 | } |
166 | 166 | ||
167 | public UUID[] GetObjectIDs(UUID regionID) | ||
168 | { | ||
169 | return m_database.GetObjectIDs(regionID); | ||
170 | } | ||
171 | |||
167 | public void SaveExtra(UUID regionID, string name, string val) | 172 | public void SaveExtra(UUID regionID, string name, string val) |
168 | { | 173 | { |
169 | m_database.SaveExtra(regionID, name, val); | 174 | m_database.SaveExtra(regionID, name, val); |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 57f2ffa..ef2494a 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -86,6 +86,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
86 | reason = String.Empty; | 86 | reason = String.Empty; |
87 | if (destination == null) | 87 | if (destination == null) |
88 | { | 88 | { |
89 | reason = "Destination not found"; | ||
89 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); | 90 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); |
90 | return false; | 91 | return false; |
91 | } | 92 | } |
@@ -359,6 +360,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
359 | return false; | 360 | return false; |
360 | } | 361 | } |
361 | 362 | ||
363 | OSDMap resp = (OSDMap)result["_Result"]; | ||
364 | success = resp["success"].AsBoolean(); | ||
365 | reason = resp["reason"].AsString(); | ||
366 | |||
362 | return success; | 367 | return success; |
363 | } | 368 | } |
364 | catch (Exception e) | 369 | catch (Exception e) |
@@ -387,26 +392,35 @@ namespace OpenSim.Services.Connectors.Simulation | |||
387 | return true; | 392 | return true; |
388 | } | 393 | } |
389 | 394 | ||
390 | /// <summary> | 395 | private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) |
391 | /// </summary> | ||
392 | public bool CloseAgent(GridRegion destination, UUID id) | ||
393 | { | 396 | { |
394 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); | 397 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); |
398 | Util.FireAndForget(x => { | ||
399 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
395 | 400 | ||
396 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | 401 | try |
397 | 402 | { | |
398 | try | 403 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); |
399 | { | 404 | } |
400 | WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); | 405 | catch (Exception e) |
401 | } | 406 | { |
402 | catch (Exception e) | 407 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); |
403 | { | 408 | } |
404 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); | 409 | }); |
405 | } | ||
406 | 410 | ||
407 | return true; | 411 | return true; |
408 | } | 412 | } |
409 | 413 | ||
414 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
415 | { | ||
416 | return CloseAgent(destination, id, true); | ||
417 | } | ||
418 | |||
419 | public bool CloseAgent(GridRegion destination, UUID id) | ||
420 | { | ||
421 | return CloseAgent(destination, id, false); | ||
422 | } | ||
423 | |||
410 | #endregion Agents | 424 | #endregion Agents |
411 | 425 | ||
412 | #region Objects | 426 | #region Objects |
@@ -444,11 +458,14 @@ namespace OpenSim.Services.Connectors.Simulation | |||
444 | args["destination_name"] = OSD.FromString(destination.RegionName); | 458 | args["destination_name"] = OSD.FromString(destination.RegionName); |
445 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 459 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
446 | 460 | ||
447 | WebUtil.PostToService(uri, args, 40000); | 461 | OSDMap response = WebUtil.PostToService(uri, args, 40000); |
462 | if (response["Success"] == "False") | ||
463 | return false; | ||
448 | } | 464 | } |
449 | catch (Exception e) | 465 | catch (Exception e) |
450 | { | 466 | { |
451 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString()); | 467 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CreateObject failed with exception; {0}",e.ToString()); |
468 | return false; | ||
452 | } | 469 | } |
453 | 470 | ||
454 | return true; | 471 | return true; |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 97d9458..6b2d710 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -187,6 +187,11 @@ namespace OpenSim.Services.Connectors | |||
187 | return accounts; | 187 | return accounts; |
188 | } | 188 | } |
189 | 189 | ||
190 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
191 | { | ||
192 | return null; // Not implemented for regions | ||
193 | } | ||
194 | |||
190 | public virtual bool StoreUserAccount(UserAccount data) | 195 | public virtual bool StoreUserAccount(UserAccount data) |
191 | { | 196 | { |
192 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 197 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |