diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Services/Connectors | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to '')
15 files changed, 576 insertions, 80 deletions
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index badacb7..795ca2e 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,13 +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>(); |
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; | ||
57 | 68 | ||
58 | public int MaxAssetRequestConcurrency | 69 | public int MaxAssetRequestConcurrency |
59 | { | 70 | { |
@@ -92,13 +103,108 @@ namespace OpenSim.Services.Connectors | |||
92 | string serviceURI = assetConfig.GetString("AssetServerURI", | 103 | string serviceURI = assetConfig.GetString("AssetServerURI", |
93 | String.Empty); | 104 | String.Empty); |
94 | 105 | ||
106 | m_ServerURI = serviceURI; | ||
107 | |||
95 | if (serviceURI == String.Empty) | 108 | if (serviceURI == String.Empty) |
96 | { | 109 | { |
97 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); | 110 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); |
98 | throw new Exception("Asset connector init error"); | 111 | throw new Exception("Asset connector init error"); |
99 | } | 112 | } |
100 | 113 | ||
101 | m_ServerURI = serviceURI; | 114 | |
115 | m_retryTimer = new System.Timers.Timer(); | ||
116 | m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); | ||
117 | m_retryTimer.Interval = 60000; | ||
118 | |||
119 | Uri serverUri = new Uri(m_ServerURI); | ||
120 | |||
121 | string groupHost = serverUri.Host; | ||
122 | |||
123 | for (int i = 0 ; i < 256 ; i++) | ||
124 | { | ||
125 | string prefix = i.ToString("x2"); | ||
126 | groupHost = assetConfig.GetString("AssetServerHost_"+prefix, groupHost); | ||
127 | |||
128 | m_UriMap[prefix] = groupHost; | ||
129 | //m_log.DebugFormat("[ASSET]: Using {0} for prefix {1}", groupHost, prefix); | ||
130 | } | ||
131 | |||
132 | m_fetchThreads = new Thread[2]; | ||
133 | |||
134 | for (int i = 0 ; i < 2 ; i++) | ||
135 | { | ||
136 | m_fetchThreads[i] = new Thread(AssetRequestProcessor); | ||
137 | m_fetchThreads[i].Start(); | ||
138 | } | ||
139 | } | ||
140 | |||
141 | private string MapServer(string id) | ||
142 | { | ||
143 | UriBuilder serverUri = new UriBuilder(m_ServerURI); | ||
144 | |||
145 | string prefix = id.Substring(0, 2).ToLower(); | ||
146 | |||
147 | string host; | ||
148 | |||
149 | // HG URLs will not be valid UUIDS | ||
150 | if (m_UriMap.ContainsKey(prefix)) | ||
151 | host = m_UriMap[prefix]; | ||
152 | else | ||
153 | host = m_UriMap["00"]; | ||
154 | |||
155 | serverUri.Host = host; | ||
156 | |||
157 | // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); | ||
158 | |||
159 | string ret = serverUri.Uri.AbsoluteUri; | ||
160 | if (ret.EndsWith("/")) | ||
161 | ret = ret.Substring(0, ret.Length - 1); | ||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | protected void retryCheck(object source, ElapsedEventArgs e) | ||
166 | { | ||
167 | m_retryCounter++; | ||
168 | if (m_retryCounter > 60) m_retryCounter -= 60; | ||
169 | List<int> keys = new List<int>(); | ||
170 | foreach (int a in m_retryQueue.Keys) | ||
171 | { | ||
172 | keys.Add(a); | ||
173 | } | ||
174 | foreach (int a in keys) | ||
175 | { | ||
176 | //We exponentially fall back on frequency until we reach one attempt per hour | ||
177 | //The net result is that we end up in the queue for roughly 24 hours.. | ||
178 | //24 hours worth of assets could be a lot, so the hope is that the region admin | ||
179 | //will have gotten the asset connector back online quickly! | ||
180 | |||
181 | int timefactor = a ^ 2; | ||
182 | if (timefactor > 60) | ||
183 | { | ||
184 | timefactor = 60; | ||
185 | } | ||
186 | |||
187 | //First, find out if we care about this timefactor | ||
188 | if (timefactor % a == 0) | ||
189 | { | ||
190 | //Yes, we do! | ||
191 | List<AssetBase> retrylist = m_retryQueue[a]; | ||
192 | m_retryQueue.Remove(a); | ||
193 | |||
194 | foreach(AssetBase ass in retrylist) | ||
195 | { | ||
196 | Store(ass); //Store my ass. This function will put it back in the dictionary if it fails | ||
197 | } | ||
198 | } | ||
199 | } | ||
200 | |||
201 | if (m_retryQueue.Count == 0) | ||
202 | { | ||
203 | //It might only be one tick per minute, but I have | ||
204 | //repented and abandoned my wasteful ways | ||
205 | m_retryCounter = 0; | ||
206 | m_retryTimer.Stop(); | ||
207 | } | ||
102 | } | 208 | } |
103 | 209 | ||
104 | protected void SetCache(IImprovedAssetCache cache) | 210 | protected void SetCache(IImprovedAssetCache cache) |
@@ -108,15 +214,13 @@ namespace OpenSim.Services.Connectors | |||
108 | 214 | ||
109 | public AssetBase Get(string id) | 215 | public AssetBase Get(string id) |
110 | { | 216 | { |
111 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); | 217 | string uri = MapServer(id) + "/assets/" + id; |
112 | |||
113 | string uri = m_ServerURI + "/assets/" + id; | ||
114 | 218 | ||
115 | AssetBase asset = null; | 219 | AssetBase asset = null; |
116 | if (m_Cache != null) | 220 | if (m_Cache != null) |
117 | asset = m_Cache.Get(id); | 221 | asset = m_Cache.Get(id); |
118 | 222 | ||
119 | if (asset == null) | 223 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
120 | { | 224 | { |
121 | // XXX: Commented out for now since this has either never been properly operational or not for some time | 225 | // XXX: Commented out for now since this has either never been properly operational or not for some time |
122 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. | 226 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. |
@@ -155,7 +259,7 @@ namespace OpenSim.Services.Connectors | |||
155 | return fullAsset.Metadata; | 259 | return fullAsset.Metadata; |
156 | } | 260 | } |
157 | 261 | ||
158 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 262 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; |
159 | 263 | ||
160 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); | 264 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
161 | return asset; | 265 | return asset; |
@@ -171,11 +275,18 @@ namespace OpenSim.Services.Connectors | |||
171 | return fullAsset.Data; | 275 | return fullAsset.Data; |
172 | } | 276 | } |
173 | 277 | ||
278 | <<<<<<< HEAD | ||
174 | using (RestClient rc = new RestClient(m_ServerURI)) | 279 | using (RestClient rc = new RestClient(m_ServerURI)) |
175 | { | 280 | { |
176 | rc.AddResourcePath("assets"); | 281 | rc.AddResourcePath("assets"); |
177 | rc.AddResourcePath(id); | 282 | rc.AddResourcePath(id); |
178 | rc.AddResourcePath("data"); | 283 | rc.AddResourcePath("data"); |
284 | ======= | ||
285 | RestClient rc = new RestClient(MapServer(id)); | ||
286 | rc.AddResourcePath("assets"); | ||
287 | rc.AddResourcePath(id); | ||
288 | rc.AddResourcePath("data"); | ||
289 | >>>>>>> avn/ubitvar | ||
179 | 290 | ||
180 | rc.RequestMethod = "GET"; | 291 | rc.RequestMethod = "GET"; |
181 | 292 | ||
@@ -189,72 +300,147 @@ namespace OpenSim.Services.Connectors | |||
189 | byte[] ret = new byte[s.Length]; | 300 | byte[] ret = new byte[s.Length]; |
190 | s.Read(ret, 0, (int)s.Length); | 301 | s.Read(ret, 0, (int)s.Length); |
191 | 302 | ||
303 | <<<<<<< HEAD | ||
192 | return ret; | 304 | return ret; |
193 | } | 305 | } |
194 | 306 | ||
195 | return null; | 307 | return null; |
196 | } | 308 | } |
309 | ======= | ||
310 | s.Close(); | ||
311 | return ret; | ||
312 | } | ||
313 | |||
314 | s.Close(); | ||
315 | return null; | ||
316 | >>>>>>> avn/ubitvar | ||
197 | } | 317 | } |
198 | 318 | ||
199 | public bool Get(string id, Object sender, AssetRetrieved handler) | 319 | private class QueuedAssetRequest |
200 | { | 320 | { |
201 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); | 321 | public string uri; |
322 | public string id; | ||
323 | } | ||
202 | 324 | ||
203 | string uri = m_ServerURI + "/assets/" + id; | 325 | private OpenMetaverse.BlockingQueue<QueuedAssetRequest> m_requestQueue = |
326 | new OpenMetaverse.BlockingQueue<QueuedAssetRequest>(); | ||
204 | 327 | ||
205 | AssetBase asset = null; | 328 | private void AssetRequestProcessor() |
206 | if (m_Cache != null) | 329 | { |
207 | asset = m_Cache.Get(id); | 330 | QueuedAssetRequest r; |
208 | 331 | ||
209 | if (asset == null) | 332 | while (true) |
210 | { | 333 | { |
211 | lock (m_AssetHandlers) | 334 | r = m_requestQueue.Dequeue(); |
212 | { | ||
213 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
214 | 335 | ||
215 | AssetRetrievedEx handlers; | 336 | string uri = r.uri; |
216 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | 337 | string id = r.id; |
217 | { | ||
218 | // Someone else is already loading this asset. It will notify our handler when done. | ||
219 | handlers += handlerEx; | ||
220 | return true; | ||
221 | } | ||
222 | |||
223 | // Load the asset ourselves | ||
224 | handlers += handlerEx; | ||
225 | m_AssetHandlers.Add(id, handlers); | ||
226 | } | ||
227 | 338 | ||
228 | bool success = false; | 339 | bool success = false; |
229 | try | 340 | try |
230 | { | 341 | { |
231 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, | 342 | AssetBase a = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, 30); |
232 | delegate(AssetBase a) | 343 | if (a != null) |
344 | { | ||
345 | if (m_Cache != null) | ||
346 | m_Cache.Cache(a); | ||
347 | |||
348 | List<AssetRetrievedEx> handlers; | ||
349 | lock (m_AssetHandlers) | ||
233 | { | 350 | { |
351 | <<<<<<< HEAD | ||
234 | if (a != null && m_Cache != null) | 352 | if (a != null && m_Cache != null) |
235 | m_Cache.Cache(a); | 353 | m_Cache.Cache(a); |
354 | ======= | ||
355 | handlers = m_AssetHandlers[id]; | ||
356 | m_AssetHandlers.Remove(id); | ||
357 | } | ||
358 | >>>>>>> avn/ubitvar | ||
236 | 359 | ||
237 | AssetRetrievedEx handlers; | 360 | Util.FireAndForget(x => |
238 | lock (m_AssetHandlers) | ||
239 | { | 361 | { |
362 | <<<<<<< HEAD | ||
240 | handlers = m_AssetHandlers[id]; | 363 | handlers = m_AssetHandlers[id]; |
241 | m_AssetHandlers.Remove(id); | 364 | m_AssetHandlers.Remove(id); |
242 | } | 365 | } |
243 | handlers.Invoke(a); | 366 | handlers.Invoke(a); |
244 | }, m_maxAssetRequestConcurrency, m_Auth); | 367 | }, m_maxAssetRequestConcurrency, m_Auth); |
368 | ======= | ||
369 | foreach (AssetRetrievedEx h in handlers) | ||
370 | { | ||
371 | // Util.FireAndForget(x => | ||
372 | // { | ||
373 | try { h.Invoke(a); } | ||
374 | catch { } | ||
375 | // }); | ||
376 | } | ||
377 | |||
378 | if (handlers != null) | ||
379 | handlers.Clear(); | ||
380 | |||
381 | }); | ||
382 | |||
383 | // if (handlers != null) | ||
384 | // handlers.Clear(); | ||
385 | >>>>>>> avn/ubitvar | ||
245 | 386 | ||
246 | success = true; | 387 | success = true; |
388 | } | ||
247 | } | 389 | } |
248 | finally | 390 | finally |
249 | { | 391 | { |
250 | if (!success) | 392 | if (!success) |
251 | { | 393 | { |
394 | List<AssetRetrievedEx> handlers; | ||
252 | lock (m_AssetHandlers) | 395 | lock (m_AssetHandlers) |
253 | { | 396 | { |
397 | handlers = m_AssetHandlers[id]; | ||
254 | m_AssetHandlers.Remove(id); | 398 | m_AssetHandlers.Remove(id); |
255 | } | 399 | } |
400 | if (handlers != null) | ||
401 | handlers.Clear(); | ||
402 | } | ||
403 | } | ||
404 | } | ||
405 | } | ||
406 | |||
407 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
408 | { | ||
409 | string uri = MapServer(id) + "/assets/" + id; | ||
410 | |||
411 | AssetBase asset = null; | ||
412 | if (m_Cache != null) | ||
413 | asset = m_Cache.Get(id); | ||
414 | |||
415 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | ||
416 | { | ||
417 | lock (m_AssetHandlers) | ||
418 | { | ||
419 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | ||
420 | |||
421 | // AssetRetrievedEx handlers; | ||
422 | List<AssetRetrievedEx> handlers; | ||
423 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | ||
424 | { | ||
425 | // Someone else is already loading this asset. It will notify our handler when done. | ||
426 | // handlers += handlerEx; | ||
427 | handlers.Add(handlerEx); | ||
428 | return true; | ||
256 | } | 429 | } |
430 | |||
431 | // Load the asset ourselves | ||
432 | // handlers += handlerEx; | ||
433 | handlers = new List<AssetRetrievedEx>(); | ||
434 | handlers.Add(handlerEx); | ||
435 | |||
436 | m_AssetHandlers.Add(id, handlers); | ||
257 | } | 437 | } |
438 | |||
439 | QueuedAssetRequest request = new QueuedAssetRequest(); | ||
440 | request.id = id; | ||
441 | request.uri = uri; | ||
442 | |||
443 | m_requestQueue.Enqueue(request); | ||
258 | } | 444 | } |
259 | else | 445 | else |
260 | { | 446 | { |
@@ -287,19 +473,44 @@ namespace OpenSim.Services.Connectors | |||
287 | 473 | ||
288 | public string Store(AssetBase asset) | 474 | public string Store(AssetBase asset) |
289 | { | 475 | { |
290 | if (asset.Local) | 476 | // Have to assign the asset ID here. This isn't likely to |
477 | // trigger since current callers don't pass emtpy IDs | ||
478 | // We need the asset ID to route the request to the proper | ||
479 | // cluster member, so we can't have the server assign one. | ||
480 | if (asset.ID == string.Empty) | ||
291 | { | 481 | { |
292 | if (m_Cache != null) | 482 | if (asset.FullID == UUID.Zero) |
293 | m_Cache.Cache(asset); | 483 | { |
484 | asset.FullID = UUID.Random(); | ||
485 | } | ||
486 | asset.ID = asset.FullID.ToString(); | ||
487 | } | ||
488 | else if (asset.FullID == UUID.Zero) | ||
489 | { | ||
490 | UUID uuid = UUID.Zero; | ||
491 | if (UUID.TryParse(asset.ID, out uuid)) | ||
492 | { | ||
493 | asset.FullID = uuid; | ||
494 | } | ||
495 | else | ||
496 | { | ||
497 | asset.FullID = UUID.Random(); | ||
498 | } | ||
499 | } | ||
294 | 500 | ||
501 | if (m_Cache != null) | ||
502 | m_Cache.Cache(asset); | ||
503 | if (asset.Temporary || asset.Local) | ||
504 | { | ||
295 | return asset.ID; | 505 | return asset.ID; |
296 | } | 506 | } |
297 | 507 | ||
298 | string uri = m_ServerURI + "/assets/"; | 508 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
299 | 509 | ||
300 | string newID; | 510 | string newID; |
301 | try | 511 | try |
302 | { | 512 | { |
513 | <<<<<<< HEAD | ||
303 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); | 514 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); |
304 | } | 515 | } |
305 | catch (Exception e) | 516 | catch (Exception e) |
@@ -324,6 +535,60 @@ namespace OpenSim.Services.Connectors | |||
324 | m_Cache.Cache(asset); | 535 | m_Cache.Cache(asset); |
325 | 536 | ||
326 | return newID; | 537 | return newID; |
538 | ======= | ||
539 | newID = SynchronousRestObjectRequester. | ||
540 | MakeRequest<AssetBase, string>("POST", uri, asset, 25); | ||
541 | if (newID == null || newID == "") | ||
542 | { | ||
543 | newID = UUID.Zero.ToString(); | ||
544 | } | ||
545 | } | ||
546 | catch (Exception e) | ||
547 | { | ||
548 | newID = UUID.Zero.ToString(); | ||
549 | } | ||
550 | |||
551 | if (newID == UUID.Zero.ToString()) | ||
552 | { | ||
553 | //The asset upload failed, put it in a queue for later | ||
554 | asset.UploadAttempts++; | ||
555 | if (asset.UploadAttempts > 30) | ||
556 | { | ||
557 | //By this stage we've been in the queue for a good few hours; | ||
558 | //We're going to drop the asset. | ||
559 | m_log.ErrorFormat("[Assets] Dropping asset {0} - Upload has been in the queue for too long.", asset.ID.ToString()); | ||
560 | } | ||
561 | else | ||
562 | { | ||
563 | if (!m_retryQueue.ContainsKey(asset.UploadAttempts)) | ||
564 | { | ||
565 | m_retryQueue.Add(asset.UploadAttempts, new List<AssetBase>()); | ||
566 | } | ||
567 | List<AssetBase> m_queue = m_retryQueue[asset.UploadAttempts]; | ||
568 | m_queue.Add(asset); | ||
569 | m_log.WarnFormat("[Assets] Upload failed: {0} - Requeuing asset for another run.", asset.ID.ToString()); | ||
570 | m_retryTimer.Start(); | ||
571 | } | ||
572 | } | ||
573 | else | ||
574 | { | ||
575 | if (asset.UploadAttempts > 0) | ||
576 | { | ||
577 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), asset.UploadAttempts.ToString()); | ||
578 | } | ||
579 | if (newID != String.Empty) | ||
580 | { | ||
581 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
582 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
583 | if (newID != null) | ||
584 | asset.ID = newID; | ||
585 | |||
586 | if (m_Cache != null) | ||
587 | m_Cache.Cache(asset); | ||
588 | } | ||
589 | } | ||
590 | return asset.ID; | ||
591 | >>>>>>> avn/ubitvar | ||
327 | } | 592 | } |
328 | 593 | ||
329 | public bool UpdateContent(string id, byte[] data) | 594 | public bool UpdateContent(string id, byte[] data) |
@@ -344,7 +609,7 @@ namespace OpenSim.Services.Connectors | |||
344 | } | 609 | } |
345 | asset.Data = data; | 610 | asset.Data = data; |
346 | 611 | ||
347 | string uri = m_ServerURI + "/assets/" + id; | 612 | string uri = MapServer(id) + "/assets/" + id; |
348 | 613 | ||
349 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) | 614 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
350 | { | 615 | { |
@@ -358,7 +623,7 @@ namespace OpenSim.Services.Connectors | |||
358 | 623 | ||
359 | public bool Delete(string id) | 624 | public bool Delete(string id) |
360 | { | 625 | { |
361 | string uri = m_ServerURI + "/assets/" + id; | 626 | string uri = MapServer(id) + "/assets/" + id; |
362 | 627 | ||
363 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) | 628 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
364 | { | 629 | { |
diff --git a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs index c8a4912..0443f5a 100644 --- a/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authentication/AuthenticationServicesConnector.cs | |||
@@ -84,6 +84,13 @@ namespace OpenSim.Services.Connectors | |||
84 | base.Initialise(source, "AuthenticationService"); | 84 | base.Initialise(source, "AuthenticationService"); |
85 | } | 85 | } |
86 | 86 | ||
87 | public string Authenticate(UUID principalID, string password, int lifetime, out UUID realID) | ||
88 | { | ||
89 | realID = UUID.Zero; | ||
90 | |||
91 | return Authenticate(principalID, password, lifetime); | ||
92 | } | ||
93 | |||
87 | public string Authenticate(UUID principalID, string password, int lifetime) | 94 | public string Authenticate(UUID principalID, string password, int lifetime) |
88 | { | 95 | { |
89 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 96 | 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 9e55356..d208f1e 100644 --- a/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServicesConnector.cs | |||
@@ -49,6 +49,9 @@ namespace OpenSim.Services.Connectors | |||
49 | 49 | ||
50 | private string m_ServerURI = String.Empty; | 50 | private string m_ServerURI = String.Empty; |
51 | 51 | ||
52 | private ExpiringCache<ulong, GridRegion> m_regionCache = | ||
53 | new ExpiringCache<ulong, GridRegion>(); | ||
54 | |||
52 | public GridServicesConnector() | 55 | public GridServicesConnector() |
53 | { | 56 | { |
54 | } | 57 | } |
@@ -275,6 +278,11 @@ namespace OpenSim.Services.Connectors | |||
275 | 278 | ||
276 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 279 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
277 | { | 280 | { |
281 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
282 | |||
283 | if (m_regionCache.Contains(regionHandle)) | ||
284 | return (GridRegion)m_regionCache[regionHandle]; | ||
285 | |||
278 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 286 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
279 | 287 | ||
280 | sendData["SCOPEID"] = scopeID.ToString(); | 288 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -316,6 +324,8 @@ namespace OpenSim.Services.Connectors | |||
316 | else | 324 | else |
317 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 325 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
318 | 326 | ||
327 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
328 | |||
319 | return rinfo; | 329 | return rinfo; |
320 | } | 330 | } |
321 | 331 | ||
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index b1663ee..2340998 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
161 | try | 161 | try |
162 | { | 162 | { |
163 | WebClient c = new WebClient(); | 163 | WebClient c = new WebClient(); |
164 | //m_log.Debug("JPEG: " + imageURL); | ||
164 | string name = regionID.ToString(); | 165 | string name = regionID.ToString(); |
165 | filename = Path.Combine(storagePath, name + ".jpg"); | 166 | filename = Path.Combine(storagePath, name + ".jpg"); |
166 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); | 167 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); |
@@ -189,11 +190,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
189 | 190 | ||
190 | ass.Data = imageData; | 191 | ass.Data = imageData; |
191 | 192 | ||
192 | mapTile = ass.FullID; | ||
193 | |||
194 | // finally | ||
195 | m_AssetService.Store(ass); | 193 | m_AssetService.Store(ass); |
196 | 194 | ||
195 | // finally | ||
196 | mapTile = ass.FullID; | ||
197 | } | 197 | } |
198 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke | 198 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke |
199 | { | 199 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 8abd046..10b8d22 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -100,10 +100,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
100 | m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); | 100 | m_log.Error("[USER AGENT CONNECTOR]: No Server URI named in section UserAgentService"); |
101 | throw new Exception("UserAgent connector init error"); | 101 | throw new Exception("UserAgent connector init error"); |
102 | } | 102 | } |
103 | <<<<<<< HEAD | ||
103 | 104 | ||
104 | m_ServerURL = m_ServerURLHost = serviceURI; | 105 | m_ServerURL = m_ServerURLHost = serviceURI; |
105 | if (!m_ServerURL.EndsWith("/")) | 106 | if (!m_ServerURL.EndsWith("/")) |
106 | m_ServerURL += "/"; | 107 | m_ServerURL += "/"; |
108 | ======= | ||
109 | m_ServerURL = serviceURI; | ||
110 | >>>>>>> avn/ubitvar | ||
107 | 111 | ||
108 | //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL); | 112 | //m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0}", m_ServerURL); |
109 | } | 113 | } |
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 644331a..3408f7a 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/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 677825e..a0ac5f9 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |||
@@ -149,13 +149,75 @@ namespace OpenSim.Services.Connectors | |||
149 | return false; | 149 | return false; |
150 | } | 150 | } |
151 | 151 | ||
152 | public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) | 152 | public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) |
153 | { | 153 | { |
154 | reason = string.Empty; | 154 | reason = string.Empty; |
155 | int tickstart = Util.EnvironmentTickCount(); | 155 | int tickstart = Util.EnvironmentTickCount(); |
156 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 156 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
157 | sendData["X"] = x.ToString(); | 157 | sendData["X"] = x.ToString(); |
158 | sendData["Y"] = y.ToString(); | 158 | sendData["Y"] = y.ToString(); |
159 | sendData["SCOPE"] = scopeID.ToString(); | ||
160 | |||
161 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
162 | string uri = m_ServerURI + "/removemap"; | ||
163 | |||
164 | try | ||
165 | { | ||
166 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
167 | uri, | ||
168 | reqString); | ||
169 | if (reply != string.Empty) | ||
170 | { | ||
171 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
172 | |||
173 | if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success")) | ||
174 | { | ||
175 | return true; | ||
176 | } | ||
177 | else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure")) | ||
178 | { | ||
179 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString()); | ||
180 | reason = replyData["Message"].ToString(); | ||
181 | return false; | ||
182 | } | ||
183 | else if (!replyData.ContainsKey("Result")) | ||
184 | { | ||
185 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field"); | ||
186 | } | ||
187 | else | ||
188 | { | ||
189 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString()); | ||
190 | reason = "Unexpected result " + replyData["Result"].ToString(); | ||
191 | } | ||
192 | |||
193 | } | ||
194 | else | ||
195 | { | ||
196 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply"); | ||
197 | } | ||
198 | } | ||
199 | catch (Exception e) | ||
200 | { | ||
201 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message); | ||
202 | } | ||
203 | finally | ||
204 | { | ||
205 | // This just dumps a warning for any operation that takes more than 100 ms | ||
206 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
207 | m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff); | ||
208 | } | ||
209 | |||
210 | return false; | ||
211 | } | ||
212 | |||
213 | public bool AddMapTile(int x, int y, byte[] jpgData, UUID scopeID, out string reason) | ||
214 | { | ||
215 | reason = string.Empty; | ||
216 | int tickstart = Util.EnvironmentTickCount(); | ||
217 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
218 | sendData["X"] = x.ToString(); | ||
219 | sendData["Y"] = y.ToString(); | ||
220 | sendData["SCOPE"] = scopeID.ToString(); | ||
159 | sendData["TYPE"] = "image/jpeg"; | 221 | sendData["TYPE"] = "image/jpeg"; |
160 | sendData["DATA"] = Convert.ToBase64String(jpgData); | 222 | sendData["DATA"] = Convert.ToBase64String(jpgData); |
161 | 223 | ||
@@ -216,7 +278,7 @@ namespace OpenSim.Services.Connectors | |||
216 | 278 | ||
217 | } | 279 | } |
218 | 280 | ||
219 | public byte[] GetMapTile(string fileName, out string format) | 281 | public byte[] GetMapTile(string fileName, UUID scopeID, out string format) |
220 | { | 282 | { |
221 | format = string.Empty; | 283 | format = string.Empty; |
222 | new Exception("GetMapTile method not Implemented"); | 284 | new Exception("GetMapTile method not Implemented"); |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index eecf096..e236ec3 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -153,9 +153,15 @@ namespace OpenSim.Services.Connectors | |||
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception e) |
155 | { | 155 | { |
156 | <<<<<<< HEAD | ||
156 | m_log.Warn(string.Format( | 157 | m_log.Warn(string.Format( |
157 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ", | 158 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ", |
158 | thisRegion.RegionName, region.RegionName, uri, e.Message), e); | 159 | thisRegion.RegionName, region.RegionName, uri, e.Message), e); |
160 | ======= | ||
161 | // m_log.WarnFormat( | ||
162 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", | ||
163 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); | ||
164 | >>>>>>> avn/ubitvar | ||
159 | 165 | ||
160 | return false; | 166 | return false; |
161 | } | 167 | } |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index 63f3f37..e474d41 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -313,6 +313,17 @@ namespace OpenSim.Services.Connectors | |||
313 | { | 313 | { |
314 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | 314 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); |
315 | } | 315 | } |
316 | else | ||
317 | { | ||
318 | if (replyData["result"].ToString() == "null") | ||
319 | return null; | ||
320 | |||
321 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
322 | } | ||
323 | } | ||
324 | else | ||
325 | { | ||
326 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for sessionID {0}", sessionID.ToString()); | ||
316 | } | 327 | } |
317 | 328 | ||
318 | return pinfo; | 329 | return pinfo; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 3bd11d9..c402907 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 b031f21..6043b70 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(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight); | 115 | Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, 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) }, |
@@ -412,6 +423,83 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
412 | 423 | ||
413 | #endregion IGridService | 424 | #endregion IGridService |
414 | 425 | ||
426 | private void UploadMapTile(IScene scene) | ||
427 | { | ||
428 | string errorMessage = null; | ||
429 | |||
430 | // Create a PNG map tile and upload it to the AddMapTile API | ||
431 | byte[] pngData = Utils.EmptyBytes; | ||
432 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | ||
433 | if (tileGenerator == null) | ||
434 | { | ||
435 | m_log.Warn("[SIMIAN GRID CONNECTOR]: Cannot upload PNG map tile without an IMapImageGenerator"); | ||
436 | return; | ||
437 | } | ||
438 | |||
439 | using (Image mapTile = tileGenerator.CreateMapTile()) | ||
440 | { | ||
441 | using (MemoryStream stream = new MemoryStream()) | ||
442 | { | ||
443 | mapTile.Save(stream, ImageFormat.Png); | ||
444 | pngData = stream.ToArray(); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
449 | { | ||
450 | new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
451 | new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
452 | new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
453 | }; | ||
454 | |||
455 | // Make the remote storage request | ||
456 | try | ||
457 | { | ||
458 | HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); | ||
459 | |||
460 | HttpWebResponse response = MultipartForm.Post(request, postParameters); | ||
461 | using (Stream responseStream = response.GetResponseStream()) | ||
462 | { | ||
463 | string responseStr = null; | ||
464 | |||
465 | try | ||
466 | { | ||
467 | responseStr = responseStream.GetStreamString(); | ||
468 | OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
469 | if (responseOSD.Type == OSDType.Map) | ||
470 | { | ||
471 | OSDMap responseMap = (OSDMap)responseOSD; | ||
472 | if (responseMap["Success"].AsBoolean()) | ||
473 | m_log.Info("[SIMIAN GRID CONNECTOR]: Uploaded " + pngData.Length + " byte PNG map tile to AddMapTile"); | ||
474 | else | ||
475 | errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
476 | } | ||
477 | else | ||
478 | { | ||
479 | errorMessage = "Response format was invalid:\n" + responseStr; | ||
480 | } | ||
481 | } | ||
482 | catch (Exception ex) | ||
483 | { | ||
484 | if (!String.IsNullOrEmpty(responseStr)) | ||
485 | errorMessage = "Failed to parse the response:\n" + responseStr; | ||
486 | else | ||
487 | errorMessage = "Failed to retrieve the response: " + ex.Message; | ||
488 | } | ||
489 | } | ||
490 | } | ||
491 | catch (WebException ex) | ||
492 | { | ||
493 | errorMessage = ex.Message; | ||
494 | } | ||
495 | |||
496 | if (!String.IsNullOrEmpty(errorMessage)) | ||
497 | { | ||
498 | m_log.WarnFormat("[SIMIAN GRID CONNECTOR]: Failed to store {0} byte PNG map tile for {1}: {2}", | ||
499 | pngData.Length, scene.RegionInfo.RegionName, errorMessage.Replace('\n', ' ')); | ||
500 | } | ||
501 | } | ||
502 | |||
415 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) | 503 | private GridRegion GetNearestRegion(Vector3d position, bool onlyEnabled) |
416 | { | 504 | { |
417 | NameValueCollection requestArgs = new NameValueCollection | 505 | NameValueCollection requestArgs = new NameValueCollection |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 698c4c0..08c5c50 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -191,9 +191,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | <<<<<<< HEAD | ||
194 | public void InvalidateCache(UUID userID) | 195 | public void InvalidateCache(UUID userID) |
195 | { | 196 | { |
196 | m_accountCache.Remove(userID); | 197 | m_accountCache.Remove(userID); |
198 | ======= | ||
199 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
200 | { | ||
201 | return null; | ||
202 | >>>>>>> avn/ubitvar | ||
197 | } | 203 | } |
198 | 204 | ||
199 | public bool StoreUserAccount(UserAccount data) | 205 | public bool StoreUserAccount(UserAccount data) |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 1eedbef..28b6de7 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -112,6 +112,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
112 | 112 | ||
113 | if (destination == null) | 113 | if (destination == null) |
114 | { | 114 | { |
115 | reason = "Destination not found"; | ||
115 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); | 116 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); |
116 | return false; | 117 | return false; |
117 | } | 118 | } |
@@ -282,7 +283,13 @@ namespace OpenSim.Services.Connectors.Simulation | |||
282 | } | 283 | } |
283 | 284 | ||
284 | 285 | ||
286 | <<<<<<< HEAD | ||
285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List<UUID> featuresAvailable, out string version, out string reason) | 287 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, List<UUID> featuresAvailable, out string version, out string reason) |
288 | ======= | ||
289 | /// <summary> | ||
290 | /// </summary> | ||
291 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason) | ||
292 | >>>>>>> avn/ubitvar | ||
286 | { | 293 | { |
287 | reason = "Failed to contact destination"; | 294 | reason = "Failed to contact destination"; |
288 | version = "Unknown"; | 295 | version = "Unknown"; |
@@ -299,6 +306,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
299 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); | 306 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); |
300 | request.Add("position", OSD.FromString(position.ToString())); | 307 | request.Add("position", OSD.FromString(position.ToString())); |
301 | request.Add("my_version", OSD.FromString(myversion)); | 308 | request.Add("my_version", OSD.FromString(myversion)); |
309 | <<<<<<< HEAD | ||
302 | 310 | ||
303 | OSDArray features = new OSDArray(); | 311 | OSDArray features = new OSDArray(); |
304 | foreach (UUID feature in featuresAvailable) | 312 | foreach (UUID feature in featuresAvailable) |
@@ -306,6 +314,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
306 | 314 | ||
307 | request.Add("features", features); | 315 | request.Add("features", features); |
308 | 316 | ||
317 | ======= | ||
318 | >>>>>>> avn/ubitvar | ||
309 | if (agentHomeURI != null) | 319 | if (agentHomeURI != null) |
310 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); | 320 | request.Add("agent_home_uri", OSD.FromString(agentHomeURI)); |
311 | 321 | ||
@@ -356,6 +366,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
356 | return false; | 366 | return false; |
357 | } | 367 | } |
358 | 368 | ||
369 | <<<<<<< HEAD | ||
359 | 370 | ||
360 | featuresAvailable.Clear(); | 371 | featuresAvailable.Clear(); |
361 | 372 | ||
@@ -366,6 +377,11 @@ namespace OpenSim.Services.Connectors.Simulation | |||
366 | foreach (OSD o in array) | 377 | foreach (OSD o in array) |
367 | featuresAvailable.Add(new UUID(o.AsString())); | 378 | featuresAvailable.Add(new UUID(o.AsString())); |
368 | } | 379 | } |
380 | ======= | ||
381 | OSDMap resp = (OSDMap)result["_Result"]; | ||
382 | success = resp["success"].AsBoolean(); | ||
383 | reason = resp["reason"].AsString(); | ||
384 | >>>>>>> avn/ubitvar | ||
369 | 385 | ||
370 | return success; | 386 | return success; |
371 | } | 387 | } |
@@ -451,12 +467,17 @@ namespace OpenSim.Services.Connectors.Simulation | |||
451 | args["destination_name"] = OSD.FromString(destination.RegionName); | 467 | args["destination_name"] = OSD.FromString(destination.RegionName); |
452 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 468 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
453 | 469 | ||
470 | <<<<<<< HEAD | ||
454 | OSDMap result = WebUtil.PostToService(uri, args, 40000, false); | 471 | OSDMap result = WebUtil.PostToService(uri, args, 40000, false); |
455 | 472 | ||
456 | if (result == null) | 473 | if (result == null) |
457 | return false; | 474 | return false; |
458 | bool success = result["success"].AsBoolean(); | 475 | bool success = result["success"].AsBoolean(); |
459 | if (!success) | 476 | if (!success) |
477 | ======= | ||
478 | OSDMap response = WebUtil.PostToService(uri, args, 40000); | ||
479 | if (response["Success"] == "False") | ||
480 | >>>>>>> avn/ubitvar | ||
460 | return false; | 481 | return false; |
461 | } | 482 | } |
462 | catch (Exception e) | 483 | catch (Exception e) |
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 560e6c4..e5fb5a8 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -191,8 +191,14 @@ namespace OpenSim.Services.Connectors | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | <<<<<<< HEAD | ||
194 | public void InvalidateCache(UUID userID) | 195 | public void InvalidateCache(UUID userID) |
195 | { | 196 | { |
197 | ======= | ||
198 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
199 | { | ||
200 | return null; // Not implemented for regions | ||
201 | >>>>>>> avn/ubitvar | ||
196 | } | 202 | } |
197 | 203 | ||
198 | public virtual bool StoreUserAccount(UserAccount data) | 204 | public virtual bool StoreUserAccount(UserAccount data) |