diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Services/Connectors | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to '')
33 files changed, 1149 insertions, 326 deletions
diff --git a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs index 1dbc0c8..bd342fa 100644 --- a/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs +++ b/OpenSim/Services/Connectors/AgentPreferences/AgentPreferencesConnector.cs | |||
@@ -62,7 +62,7 @@ namespace OpenSim.Services.Connectors | |||
62 | Initialise(source); | 62 | Initialise(source); |
63 | } | 63 | } |
64 | 64 | ||
65 | public virtual void Initialise(IConfigSource source) | 65 | public void Initialise(IConfigSource source) |
66 | { | 66 | { |
67 | IConfig gridConfig = source.Configs["AgentPreferencesService"]; | 67 | IConfig gridConfig = source.Configs["AgentPreferencesService"]; |
68 | if (gridConfig == null) | 68 | if (gridConfig == null) |
@@ -110,7 +110,7 @@ namespace OpenSim.Services.Connectors | |||
110 | { | 110 | { |
111 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); | 111 | m_log.DebugFormat("[AGENT PREFERENCES CONNECTOR]: Exception when contacting agent preferences server at {0}: {1}", uri, e.Message); |
112 | } | 112 | } |
113 | 113 | ||
114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 114 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
115 | if (replyData != null) | 115 | if (replyData != null) |
116 | { | 116 | { |
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index bd43552..7e81be7 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -27,12 +27,14 @@ | |||
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.Monitoring; |
36 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
37 | using OpenMetaverse; | 39 | using OpenMetaverse; |
38 | 40 | ||
@@ -44,15 +46,27 @@ namespace OpenSim.Services.Connectors | |||
44 | LogManager.GetLogger( | 46 | LogManager.GetLogger( |
45 | MethodBase.GetCurrentMethod().DeclaringType); | 47 | MethodBase.GetCurrentMethod().DeclaringType); |
46 | 48 | ||
49 | const int MAXSENDRETRIESLEN = 30; | ||
50 | |||
47 | private string m_ServerURI = String.Empty; | 51 | private string m_ServerURI = String.Empty; |
48 | private IImprovedAssetCache m_Cache = null; | 52 | private IAssetCache m_Cache = null; |
53 | private int m_retryCounter; | ||
54 | private bool m_inRetries; | ||
55 | private List<AssetBase>[] m_sendRetries = new List<AssetBase>[MAXSENDRETRIESLEN]; | ||
56 | private System.Timers.Timer m_retryTimer; | ||
49 | private int m_maxAssetRequestConcurrency = 30; | 57 | private int m_maxAssetRequestConcurrency = 30; |
50 | 58 | ||
51 | private delegate void AssetRetrievedEx(AssetBase asset); | 59 | private delegate void AssetRetrievedEx(AssetBase asset); |
52 | 60 | ||
53 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. | 61 | // Keeps track of concurrent requests for the same asset, so that it's only loaded once. |
54 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded | 62 | // Maps: Asset ID -> Handlers which will be called when the asset has been loaded |
55 | private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); | 63 | // private Dictionary<string, AssetRetrievedEx> m_AssetHandlers = new Dictionary<string, AssetRetrievedEx>(); |
64 | |||
65 | private Dictionary<string, List<AssetRetrievedEx>> m_AssetHandlers = new Dictionary<string, List<AssetRetrievedEx>>(); | ||
66 | |||
67 | private Dictionary<string, string> m_UriMap = new Dictionary<string, string>(); | ||
68 | |||
69 | private Thread[] m_fetchThreads; | ||
56 | 70 | ||
57 | public int MaxAssetRequestConcurrency | 71 | public int MaxAssetRequestConcurrency |
58 | { | 72 | { |
@@ -91,31 +105,155 @@ namespace OpenSim.Services.Connectors | |||
91 | string serviceURI = assetConfig.GetString("AssetServerURI", | 105 | string serviceURI = assetConfig.GetString("AssetServerURI", |
92 | String.Empty); | 106 | String.Empty); |
93 | 107 | ||
108 | m_ServerURI = serviceURI; | ||
109 | |||
94 | if (serviceURI == String.Empty) | 110 | if (serviceURI == String.Empty) |
95 | { | 111 | { |
96 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); | 112 | m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); |
97 | throw new Exception("Asset connector init error"); | 113 | throw new Exception("Asset connector init error"); |
98 | } | 114 | } |
99 | 115 | ||
100 | m_ServerURI = serviceURI; | 116 | m_retryTimer = new System.Timers.Timer(); |
117 | m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); | ||
118 | m_retryTimer.AutoReset = true; | ||
119 | m_retryTimer.Interval = 60000; | ||
120 | |||
121 | Uri serverUri = new Uri(m_ServerURI); | ||
122 | |||
123 | string groupHost = serverUri.Host; | ||
124 | |||
125 | for (int i = 0 ; i < 256 ; i++) | ||
126 | { | ||
127 | string prefix = i.ToString("x2"); | ||
128 | groupHost = assetConfig.GetString("AssetServerHost_"+prefix, groupHost); | ||
129 | |||
130 | m_UriMap[prefix] = groupHost; | ||
131 | //m_log.DebugFormat("[ASSET]: Using {0} for prefix {1}", groupHost, prefix); | ||
132 | } | ||
133 | |||
134 | m_fetchThreads = new Thread[2]; | ||
135 | |||
136 | for (int i = 0 ; i < 2 ; i++) | ||
137 | { | ||
138 | m_fetchThreads[i] = WorkManager.StartThread(AssetRequestProcessor, | ||
139 | String.Format("GetTextureWorker{0}", i), | ||
140 | ThreadPriority.Normal, | ||
141 | true, | ||
142 | false); | ||
143 | } | ||
144 | } | ||
145 | |||
146 | private string MapServer(string id) | ||
147 | { | ||
148 | if (m_UriMap.Count == 0) | ||
149 | return m_ServerURI; | ||
150 | |||
151 | UriBuilder serverUri = new UriBuilder(m_ServerURI); | ||
152 | |||
153 | string prefix = id.Substring(0, 2).ToLower(); | ||
154 | |||
155 | string host; | ||
156 | |||
157 | // HG URLs will not be valid UUIDS | ||
158 | if (m_UriMap.ContainsKey(prefix)) | ||
159 | host = m_UriMap[prefix]; | ||
160 | else | ||
161 | host = m_UriMap["00"]; | ||
162 | |||
163 | serverUri.Host = host; | ||
164 | |||
165 | // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); | ||
166 | |||
167 | string ret = serverUri.Uri.AbsoluteUri; | ||
168 | if (ret.EndsWith("/")) | ||
169 | ret = ret.Substring(0, ret.Length - 1); | ||
170 | return ret; | ||
101 | } | 171 | } |
102 | 172 | ||
103 | protected void SetCache(IImprovedAssetCache cache) | 173 | protected void retryCheck(object source, ElapsedEventArgs e) |
174 | { | ||
175 | lock(m_sendRetries) | ||
176 | { | ||
177 | if(m_inRetries) | ||
178 | return; | ||
179 | m_inRetries = true; | ||
180 | } | ||
181 | |||
182 | m_retryCounter++; | ||
183 | if(m_retryCounter >= 61 ) // avoid overflow 60 is max in use below | ||
184 | m_retryCounter = 1; | ||
185 | |||
186 | int inUse = 0; | ||
187 | int nextlevel; | ||
188 | int timefactor; | ||
189 | List<AssetBase> retrylist; | ||
190 | // we need to go down | ||
191 | for(int i = MAXSENDRETRIESLEN - 1; i >= 0; i--) | ||
192 | { | ||
193 | lock(m_sendRetries) | ||
194 | retrylist = m_sendRetries[i]; | ||
195 | |||
196 | if(retrylist == null) | ||
197 | continue; | ||
198 | |||
199 | inUse++; | ||
200 | nextlevel = i + 1; | ||
201 | |||
202 | //We exponentially fall back on frequency until we reach one attempt per hour | ||
203 | //The net result is that we end up in the queue for roughly 24 hours.. | ||
204 | //24 hours worth of assets could be a lot, so the hope is that the region admin | ||
205 | //will have gotten the asset connector back online quickly! | ||
206 | if(i == 0) | ||
207 | timefactor = 1; | ||
208 | else | ||
209 | { | ||
210 | timefactor = 1 << nextlevel; | ||
211 | if (timefactor > 60) | ||
212 | timefactor = 60; | ||
213 | } | ||
214 | |||
215 | if(m_retryCounter < timefactor) | ||
216 | continue; // to update inUse; | ||
217 | |||
218 | if (m_retryCounter % timefactor != 0) | ||
219 | continue; | ||
220 | |||
221 | // a list to retry | ||
222 | lock(m_sendRetries) | ||
223 | m_sendRetries[i] = null; | ||
224 | |||
225 | // we are the only ones with a copy of this retrylist now | ||
226 | foreach(AssetBase ass in retrylist) | ||
227 | retryStore(ass, nextlevel); | ||
228 | } | ||
229 | |||
230 | lock(m_sendRetries) | ||
231 | { | ||
232 | if(inUse == 0 ) | ||
233 | m_retryTimer.Stop(); | ||
234 | |||
235 | m_inRetries = false; | ||
236 | } | ||
237 | } | ||
238 | |||
239 | protected void SetCache(IAssetCache cache) | ||
104 | { | 240 | { |
105 | m_Cache = cache; | 241 | m_Cache = cache; |
106 | } | 242 | } |
107 | 243 | ||
108 | public AssetBase Get(string id) | 244 | public AssetBase Get(string id) |
109 | { | 245 | { |
110 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Synchronous get request for {0}", id); | 246 | string uri = MapServer(id) + "/assets/" + id; |
111 | |||
112 | string uri = m_ServerURI + "/assets/" + id; | ||
113 | 247 | ||
114 | AssetBase asset = null; | 248 | AssetBase asset = null; |
249 | |||
115 | if (m_Cache != null) | 250 | if (m_Cache != null) |
116 | asset = m_Cache.Get(id); | 251 | { |
252 | if (!m_Cache.Get(id, out asset)) | ||
253 | return null; | ||
254 | } | ||
117 | 255 | ||
118 | if (asset == null) | 256 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
119 | { | 257 | { |
120 | // XXX: Commented out for now since this has either never been properly operational or not for some time | 258 | // XXX: Commented out for now since this has either never been properly operational or not for some time |
121 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. | 259 | // as m_maxAssetRequestConcurrency was being passed as the timeout, not a concurrency limiting option. |
@@ -128,8 +266,14 @@ namespace OpenSim.Services.Connectors | |||
128 | 266 | ||
129 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); | 267 | asset = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, m_Auth); |
130 | 268 | ||
269 | |||
131 | if (m_Cache != null) | 270 | if (m_Cache != null) |
132 | m_Cache.Cache(asset); | 271 | { |
272 | if (asset != null) | ||
273 | m_Cache.Cache(asset); | ||
274 | else | ||
275 | m_Cache.CacheNegative(id); | ||
276 | } | ||
133 | } | 277 | } |
134 | return asset; | 278 | return asset; |
135 | } | 279 | } |
@@ -138,23 +282,28 @@ namespace OpenSim.Services.Connectors | |||
138 | { | 282 | { |
139 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); | 283 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); |
140 | 284 | ||
285 | AssetBase asset = null; | ||
141 | if (m_Cache != null) | 286 | if (m_Cache != null) |
142 | return m_Cache.Get(id); | 287 | { |
288 | m_Cache.Get(id, out asset); | ||
289 | } | ||
143 | 290 | ||
144 | return null; | 291 | return asset; |
145 | } | 292 | } |
146 | 293 | ||
147 | public AssetMetadata GetMetadata(string id) | 294 | public AssetMetadata GetMetadata(string id) |
148 | { | 295 | { |
149 | if (m_Cache != null) | 296 | if (m_Cache != null) |
150 | { | 297 | { |
151 | AssetBase fullAsset = m_Cache.Get(id); | 298 | AssetBase fullAsset; |
299 | if (!m_Cache.Get(id, out fullAsset)) | ||
300 | return null; | ||
152 | 301 | ||
153 | if (fullAsset != null) | 302 | if (fullAsset != null) |
154 | return fullAsset.Metadata; | 303 | return fullAsset.Metadata; |
155 | } | 304 | } |
156 | 305 | ||
157 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 306 | string uri = MapServer(id) + "/assets/" + id + "/metadata"; |
158 | 307 | ||
159 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); | 308 | AssetMetadata asset = SynchronousRestObjectRequester.MakeRequest<int, AssetMetadata>("GET", uri, 0, m_Auth); |
160 | return asset; | 309 | return asset; |
@@ -164,13 +313,15 @@ namespace OpenSim.Services.Connectors | |||
164 | { | 313 | { |
165 | if (m_Cache != null) | 314 | if (m_Cache != null) |
166 | { | 315 | { |
167 | AssetBase fullAsset = m_Cache.Get(id); | 316 | AssetBase fullAsset; |
317 | if (!m_Cache.Get(id, out fullAsset)) | ||
318 | return null; | ||
168 | 319 | ||
169 | if (fullAsset != null) | 320 | if (fullAsset != null) |
170 | return fullAsset.Data; | 321 | return fullAsset.Data; |
171 | } | 322 | } |
172 | 323 | ||
173 | using (RestClient rc = new RestClient(m_ServerURI)) | 324 | using (RestClient rc = new RestClient(MapServer(id))) |
174 | { | 325 | { |
175 | rc.AddResourcePath("assets"); | 326 | rc.AddResourcePath("assets"); |
176 | rc.AddResourcePath(id); | 327 | rc.AddResourcePath(id); |
@@ -178,81 +329,110 @@ namespace OpenSim.Services.Connectors | |||
178 | 329 | ||
179 | rc.RequestMethod = "GET"; | 330 | rc.RequestMethod = "GET"; |
180 | 331 | ||
181 | Stream s = rc.Request(m_Auth); | 332 | using (Stream s = rc.Request(m_Auth)) |
333 | { | ||
334 | if (s == null) | ||
335 | return null; | ||
182 | 336 | ||
183 | if (s == null) | 337 | if (s.Length > 0) |
184 | return null; | 338 | { |
339 | byte[] ret = new byte[s.Length]; | ||
340 | s.Read(ret, 0, (int)s.Length); | ||
341 | |||
342 | return ret; | ||
343 | } | ||
344 | } | ||
345 | return null; | ||
346 | } | ||
347 | } | ||
185 | 348 | ||
186 | if (s.Length > 0) | 349 | private class QueuedAssetRequest |
350 | { | ||
351 | public string uri; | ||
352 | public string id; | ||
353 | } | ||
354 | |||
355 | private OpenSim.Framework.BlockingQueue<QueuedAssetRequest> m_requestQueue = | ||
356 | new OpenSim.Framework.BlockingQueue<QueuedAssetRequest>(); | ||
357 | |||
358 | private void AssetRequestProcessor() | ||
359 | { | ||
360 | QueuedAssetRequest r; | ||
361 | |||
362 | while (true) | ||
363 | { | ||
364 | r = m_requestQueue.Dequeue(4500); | ||
365 | Watchdog.UpdateThread(); | ||
366 | if(r== null) | ||
367 | continue; | ||
368 | string uri = r.uri; | ||
369 | string id = r.id; | ||
370 | |||
371 | try | ||
187 | { | 372 | { |
188 | byte[] ret = new byte[s.Length]; | 373 | AssetBase a = SynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, 30000, m_Auth); |
189 | s.Read(ret, 0, (int)s.Length); | ||
190 | 374 | ||
191 | return ret; | 375 | if (a != null && m_Cache != null) |
192 | } | 376 | m_Cache.Cache(a); |
193 | 377 | ||
194 | return null; | 378 | List<AssetRetrievedEx> handlers; |
379 | lock (m_AssetHandlers) | ||
380 | { | ||
381 | handlers = m_AssetHandlers[id]; | ||
382 | m_AssetHandlers.Remove(id); | ||
383 | } | ||
384 | |||
385 | if(handlers != null) | ||
386 | { | ||
387 | Util.FireAndForget(x => | ||
388 | { | ||
389 | foreach (AssetRetrievedEx h in handlers) | ||
390 | { | ||
391 | try { h.Invoke(a); } | ||
392 | catch { } | ||
393 | } | ||
394 | handlers.Clear(); | ||
395 | }); | ||
396 | } | ||
397 | } | ||
398 | catch { } | ||
195 | } | 399 | } |
196 | } | 400 | } |
197 | 401 | ||
198 | public bool Get(string id, Object sender, AssetRetrieved handler) | 402 | public bool Get(string id, Object sender, AssetRetrieved handler) |
199 | { | 403 | { |
200 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Potentially asynchronous get request for {0}", id); | 404 | string uri = MapServer(id) + "/assets/" + id; |
201 | |||
202 | string uri = m_ServerURI + "/assets/" + id; | ||
203 | 405 | ||
204 | AssetBase asset = null; | 406 | AssetBase asset = null; |
205 | if (m_Cache != null) | 407 | if (m_Cache != null) |
206 | asset = m_Cache.Get(id); | 408 | { |
409 | if (!m_Cache.Get(id, out asset)) | ||
410 | return false; | ||
411 | } | ||
207 | 412 | ||
208 | if (asset == null) | 413 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
209 | { | 414 | { |
210 | lock (m_AssetHandlers) | 415 | lock (m_AssetHandlers) |
211 | { | 416 | { |
212 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); | 417 | AssetRetrievedEx handlerEx = new AssetRetrievedEx(delegate(AssetBase _asset) { handler(id, sender, _asset); }); |
213 | 418 | ||
214 | AssetRetrievedEx handlers; | 419 | List<AssetRetrievedEx> handlers; |
215 | if (m_AssetHandlers.TryGetValue(id, out handlers)) | 420 | if (m_AssetHandlers.TryGetValue(id, out handlers)) |
216 | { | 421 | { |
217 | // Someone else is already loading this asset. It will notify our handler when done. | 422 | // Someone else is already loading this asset. It will notify our handler when done. |
218 | handlers += handlerEx; | 423 | handlers.Add(handlerEx); |
219 | return true; | 424 | return true; |
220 | } | 425 | } |
221 | 426 | ||
222 | // Load the asset ourselves | 427 | handlers = new List<AssetRetrievedEx>(); |
223 | handlers += handlerEx; | 428 | handlers.Add(handlerEx); |
224 | m_AssetHandlers.Add(id, handlers); | ||
225 | } | ||
226 | 429 | ||
227 | bool success = false; | 430 | m_AssetHandlers.Add(id, handlers); |
228 | try | ||
229 | { | ||
230 | AsynchronousRestObjectRequester.MakeRequest<int, AssetBase>("GET", uri, 0, | ||
231 | delegate(AssetBase a) | ||
232 | { | ||
233 | if (a != null && m_Cache != null) | ||
234 | m_Cache.Cache(a); | ||
235 | 431 | ||
236 | AssetRetrievedEx handlers; | 432 | QueuedAssetRequest request = new QueuedAssetRequest(); |
237 | lock (m_AssetHandlers) | 433 | request.id = id; |
238 | { | 434 | request.uri = uri; |
239 | handlers = m_AssetHandlers[id]; | 435 | m_requestQueue.Enqueue(request); |
240 | m_AssetHandlers.Remove(id); | ||
241 | } | ||
242 | handlers.Invoke(a); | ||
243 | }, m_maxAssetRequestConcurrency, m_Auth); | ||
244 | |||
245 | success = true; | ||
246 | } | ||
247 | finally | ||
248 | { | ||
249 | if (!success) | ||
250 | { | ||
251 | lock (m_AssetHandlers) | ||
252 | { | ||
253 | m_AssetHandlers.Remove(id); | ||
254 | } | ||
255 | } | ||
256 | } | 436 | } |
257 | } | 437 | } |
258 | else | 438 | else |
@@ -277,52 +457,151 @@ namespace OpenSim.Services.Connectors | |||
277 | // This is most likely to happen because the server doesn't support this function, | 457 | // This is most likely to happen because the server doesn't support this function, |
278 | // so just silently return "doesn't exist" for all the assets. | 458 | // so just silently return "doesn't exist" for all the assets. |
279 | } | 459 | } |
280 | 460 | ||
281 | if (exist == null) | 461 | if (exist == null) |
282 | exist = new bool[ids.Length]; | 462 | exist = new bool[ids.Length]; |
283 | 463 | ||
284 | return exist; | 464 | return exist; |
285 | } | 465 | } |
286 | 466 | ||
467 | string stringUUIDZero = UUID.Zero.ToString(); | ||
468 | |||
287 | public string Store(AssetBase asset) | 469 | public string Store(AssetBase asset) |
288 | { | 470 | { |
289 | if (asset.Local) | 471 | // Have to assign the asset ID here. This isn't likely to |
472 | // trigger since current callers don't pass emtpy IDs | ||
473 | // We need the asset ID to route the request to the proper | ||
474 | // cluster member, so we can't have the server assign one. | ||
475 | if (asset.ID == string.Empty || asset.ID == stringUUIDZero) | ||
290 | { | 476 | { |
291 | if (m_Cache != null) | 477 | if (asset.FullID == UUID.Zero) |
292 | m_Cache.Cache(asset); | 478 | { |
479 | asset.FullID = UUID.Random(); | ||
480 | } | ||
481 | m_log.WarnFormat("[Assets] Zero ID: {0}",asset.Name); | ||
482 | asset.ID = asset.FullID.ToString(); | ||
483 | } | ||
484 | |||
485 | if (asset.FullID == UUID.Zero) | ||
486 | { | ||
487 | UUID uuid = UUID.Zero; | ||
488 | if (UUID.TryParse(asset.ID, out uuid)) | ||
489 | { | ||
490 | asset.FullID = uuid; | ||
491 | } | ||
492 | if(asset.FullID == UUID.Zero) | ||
493 | { | ||
494 | m_log.WarnFormat("[Assets] Zero IDs: {0}",asset.Name); | ||
495 | asset.FullID = UUID.Random(); | ||
496 | asset.ID = asset.FullID.ToString(); | ||
497 | } | ||
498 | } | ||
499 | |||
500 | if (m_Cache != null) | ||
501 | m_Cache.Cache(asset); | ||
293 | 502 | ||
503 | if (asset.Temporary || asset.Local) | ||
504 | { | ||
294 | return asset.ID; | 505 | return asset.ID; |
295 | } | 506 | } |
296 | 507 | ||
297 | string uri = m_ServerURI + "/assets/"; | 508 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; |
298 | 509 | ||
299 | string newID; | 510 | string newID = null; |
300 | try | 511 | try |
301 | { | 512 | { |
302 | newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, m_Auth); | 513 | newID = SynchronousRestObjectRequester. |
514 | MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth); | ||
303 | } | 515 | } |
304 | catch (Exception e) | 516 | catch |
305 | { | 517 | { |
306 | m_log.Warn(string.Format("[ASSET CONNECTOR]: Unable to send asset {0} to asset server. Reason: {1} ", asset.ID, e.Message), e); | 518 | newID = null; |
307 | return string.Empty; | ||
308 | } | 519 | } |
309 | 520 | ||
310 | // TEMPORARY: SRAS returns 'null' when it's asked to store existing assets | 521 | if (newID == null || newID == String.Empty || newID == stringUUIDZero) |
311 | if (newID == null) | ||
312 | { | 522 | { |
313 | m_log.DebugFormat("[ASSET CONNECTOR]: Storing of asset {0} returned null; assuming the asset already exists", asset.ID); | 523 | //The asset upload failed, try later |
314 | return asset.ID; | 524 | lock(m_sendRetries) |
525 | { | ||
526 | if (m_sendRetries[0] == null) | ||
527 | m_sendRetries[0] = new List<AssetBase>(); | ||
528 | List<AssetBase> m_queue = m_sendRetries[0]; | ||
529 | m_queue.Add(asset); | ||
530 | m_log.WarnFormat("[Assets] Upload failed: {0} type {1} will retry later", | ||
531 | asset.ID.ToString(), asset.Type.ToString()); | ||
532 | m_retryTimer.Start(); | ||
533 | } | ||
315 | } | 534 | } |
535 | else | ||
536 | { | ||
537 | if (newID != asset.ID) | ||
538 | { | ||
539 | // Placing this here, so that this work with old asset servers that don't send any reply back | ||
540 | // SynchronousRestObjectRequester returns somethins that is not an empty string | ||
316 | 541 | ||
317 | if (string.IsNullOrEmpty(newID)) | 542 | asset.ID = newID; |
318 | return string.Empty; | ||
319 | 543 | ||
320 | asset.ID = newID; | 544 | if (m_Cache != null) |
545 | m_Cache.Cache(asset); | ||
546 | } | ||
547 | } | ||
548 | return asset.ID; | ||
549 | } | ||
321 | 550 | ||
322 | if (m_Cache != null) | 551 | public void retryStore(AssetBase asset, int nextRetryLevel) |
323 | m_Cache.Cache(asset); | 552 | { |
553 | /* this may be bad, so excluding | ||
554 | if (m_Cache != null && !m_Cache.Check(asset.ID)) | ||
555 | { | ||
556 | m_log.WarnFormat("[Assets] Upload giveup asset bc no longer in local cache: {0}", | ||
557 | asset.ID.ToString(); | ||
558 | return; // if no longer in cache, it was deleted or expired | ||
559 | } | ||
560 | */ | ||
561 | string uri = MapServer(asset.FullID.ToString()) + "/assets/"; | ||
324 | 562 | ||
325 | return newID; | 563 | string newID = null; |
564 | try | ||
565 | { | ||
566 | newID = SynchronousRestObjectRequester. | ||
567 | MakeRequest<AssetBase, string>("POST", uri, asset, 100000, m_Auth); | ||
568 | } | ||
569 | catch | ||
570 | { | ||
571 | newID = null; | ||
572 | } | ||
573 | |||
574 | if (newID == null || newID == String.Empty || newID == stringUUIDZero) | ||
575 | { | ||
576 | if(nextRetryLevel >= MAXSENDRETRIESLEN) | ||
577 | m_log.WarnFormat("[Assets] Upload giveup after several retries id: {0} type {1}", | ||
578 | asset.ID.ToString(), asset.Type.ToString()); | ||
579 | else | ||
580 | { | ||
581 | lock(m_sendRetries) | ||
582 | { | ||
583 | if (m_sendRetries[nextRetryLevel] == null) | ||
584 | { | ||
585 | m_sendRetries[nextRetryLevel] = new List<AssetBase>(); | ||
586 | } | ||
587 | List<AssetBase> m_queue = m_sendRetries[nextRetryLevel]; | ||
588 | m_queue.Add(asset); | ||
589 | m_log.WarnFormat("[Assets] Upload failed: {0} type {1} will retry later", | ||
590 | asset.ID.ToString(), asset.Type.ToString()); | ||
591 | } | ||
592 | } | ||
593 | } | ||
594 | else | ||
595 | { | ||
596 | m_log.InfoFormat("[Assets] Upload of {0} succeeded after {1} failed attempts", asset.ID.ToString(), nextRetryLevel.ToString()); | ||
597 | if (newID != asset.ID) | ||
598 | { | ||
599 | asset.ID = newID; | ||
600 | |||
601 | if (m_Cache != null) | ||
602 | m_Cache.Cache(asset); | ||
603 | } | ||
604 | } | ||
326 | } | 605 | } |
327 | 606 | ||
328 | public bool UpdateContent(string id, byte[] data) | 607 | public bool UpdateContent(string id, byte[] data) |
@@ -330,7 +609,7 @@ namespace OpenSim.Services.Connectors | |||
330 | AssetBase asset = null; | 609 | AssetBase asset = null; |
331 | 610 | ||
332 | if (m_Cache != null) | 611 | if (m_Cache != null) |
333 | asset = m_Cache.Get(id); | 612 | m_Cache.Get(id, out asset); |
334 | 613 | ||
335 | if (asset == null) | 614 | if (asset == null) |
336 | { | 615 | { |
@@ -343,7 +622,7 @@ namespace OpenSim.Services.Connectors | |||
343 | } | 622 | } |
344 | asset.Data = data; | 623 | asset.Data = data; |
345 | 624 | ||
346 | string uri = m_ServerURI + "/assets/" + id; | 625 | string uri = MapServer(id) + "/assets/" + id; |
347 | 626 | ||
348 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) | 627 | if (SynchronousRestObjectRequester.MakeRequest<AssetBase, bool>("POST", uri, asset, m_Auth)) |
349 | { | 628 | { |
@@ -355,9 +634,10 @@ namespace OpenSim.Services.Connectors | |||
355 | return false; | 634 | return false; |
356 | } | 635 | } |
357 | 636 | ||
637 | |||
358 | public bool Delete(string id) | 638 | public bool Delete(string id) |
359 | { | 639 | { |
360 | string uri = m_ServerURI + "/assets/" + id; | 640 | string uri = MapServer(id) + "/assets/" + id; |
361 | 641 | ||
362 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) | 642 | if (SynchronousRestObjectRequester.MakeRequest<int, bool>("DELETE", uri, 0, m_Auth)) |
363 | { | 643 | { |
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/Authorization/AuthorizationServicesConnector.cs b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs index d2da85f..a130f71 100644 --- a/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs +++ b/OpenSim/Services/Connectors/Authorization/AuthorizationServicesConnector.cs | |||
@@ -37,7 +37,7 @@ using OpenMetaverse; | |||
37 | 37 | ||
38 | namespace OpenSim.Services.Connectors | 38 | namespace OpenSim.Services.Connectors |
39 | { | 39 | { |
40 | public class AuthorizationServicesConnector | 40 | public class AuthorizationServicesConnector |
41 | { | 41 | { |
42 | private static readonly ILog m_log = | 42 | private static readonly ILog m_log = |
43 | LogManager.GetLogger( | 43 | LogManager.GetLogger( |
@@ -45,7 +45,7 @@ namespace OpenSim.Services.Connectors | |||
45 | 45 | ||
46 | private string m_ServerURI = String.Empty; | 46 | private string m_ServerURI = String.Empty; |
47 | private bool m_ResponseOnFailure = true; | 47 | private bool m_ResponseOnFailure = true; |
48 | 48 | ||
49 | public AuthorizationServicesConnector() | 49 | public AuthorizationServicesConnector() |
50 | { | 50 | { |
51 | } | 51 | } |
@@ -78,11 +78,11 @@ namespace OpenSim.Services.Connectors | |||
78 | throw new Exception("Authorization connector init error"); | 78 | throw new Exception("Authorization connector init error"); |
79 | } | 79 | } |
80 | m_ServerURI = serviceURI; | 80 | m_ServerURI = serviceURI; |
81 | 81 | ||
82 | // this dictates what happens if the remote service fails, if the service fails and the value is true | 82 | // this dictates what happens if the remote service fails, if the service fails and the value is true |
83 | // the user is authorized for the region. | 83 | // the user is authorized for the region. |
84 | bool responseOnFailure = authorizationConfig.GetBoolean("ResponseOnFailure",true); | 84 | bool responseOnFailure = authorizationConfig.GetBoolean("ResponseOnFailure",true); |
85 | 85 | ||
86 | m_ResponseOnFailure = responseOnFailure; | 86 | m_ResponseOnFailure = responseOnFailure; |
87 | m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService initialized"); | 87 | m_log.Info("[AUTHORIZATION CONNECTOR]: AuthorizationService initialized"); |
88 | } | 88 | } |
@@ -91,11 +91,11 @@ namespace OpenSim.Services.Connectors | |||
91 | { | 91 | { |
92 | // do a remote call to the authorization server specified in the AuthorizationServerURI | 92 | // do a remote call to the authorization server specified in the AuthorizationServerURI |
93 | m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI); | 93 | m_log.InfoFormat("[AUTHORIZATION CONNECTOR]: IsAuthorizedForRegion checking {0} at remote server {1}", userID, m_ServerURI); |
94 | 94 | ||
95 | string uri = m_ServerURI; | 95 | string uri = m_ServerURI; |
96 | 96 | ||
97 | AuthorizationRequest req = new AuthorizationRequest(userID, firstname, surname, email, regionName, regionID); | 97 | AuthorizationRequest req = new AuthorizationRequest(userID, firstname, surname, email, regionName, regionID); |
98 | 98 | ||
99 | AuthorizationResponse response; | 99 | AuthorizationResponse response; |
100 | try | 100 | try |
101 | { | 101 | { |
@@ -114,7 +114,7 @@ namespace OpenSim.Services.Connectors | |||
114 | } | 114 | } |
115 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message); | 115 | m_log.DebugFormat("[AUTHORIZATION CONNECTOR] response from remote service was {0}", response.Message); |
116 | message = response.Message; | 116 | message = response.Message; |
117 | 117 | ||
118 | return response.IsAuthorized; | 118 | return response.IsAuthorized; |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs index 3f44efa..424e95a 100644 --- a/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs +++ b/OpenSim/Services/Connectors/Avatar/AvatarServicesConnector.cs | |||
@@ -94,13 +94,13 @@ namespace OpenSim.Services.Connectors | |||
94 | AvatarData avatar = GetAvatar(userID); | 94 | AvatarData avatar = GetAvatar(userID); |
95 | return avatar.ToAvatarAppearance(); | 95 | return avatar.ToAvatarAppearance(); |
96 | } | 96 | } |
97 | 97 | ||
98 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | 98 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) |
99 | { | 99 | { |
100 | AvatarData avatar = new AvatarData(appearance); | 100 | AvatarData avatar = new AvatarData(appearance); |
101 | return SetAvatar(userID,avatar); | 101 | return SetAvatar(userID,avatar); |
102 | } | 102 | } |
103 | 103 | ||
104 | public AvatarData GetAvatar(UUID userID) | 104 | public AvatarData GetAvatar(UUID userID) |
105 | { | 105 | { |
106 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 106 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
diff --git a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs index 6412bcd..b9a6281 100644 --- a/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs +++ b/OpenSim/Services/Connectors/Estate/EstateDataConnector.cs | |||
@@ -120,7 +120,7 @@ namespace OpenSim.Services.Connectors | |||
120 | // If we don't have them, load them from the server | 120 | // If we don't have them, load them from the server |
121 | List<EstateSettings> estates = null; | 121 | List<EstateSettings> estates = null; |
122 | if (!m_EstateCache.TryGetValue("estates", out estates)) | 122 | if (!m_EstateCache.TryGetValue("estates", out estates)) |
123 | LoadEstateSettingsAll(); | 123 | estates = LoadEstateSettingsAll(); |
124 | 124 | ||
125 | foreach (EstateSettings es in estates) | 125 | foreach (EstateSettings es in estates) |
126 | eids.Add((int)es.EstateID); | 126 | eids.Add((int)es.EstateID); |
@@ -133,7 +133,7 @@ namespace OpenSim.Services.Connectors | |||
133 | // If we don't have them, load them from the server | 133 | // If we don't have them, load them from the server |
134 | List<EstateSettings> estates = null; | 134 | List<EstateSettings> estates = null; |
135 | if (!m_EstateCache.TryGetValue("estates", out estates)) | 135 | if (!m_EstateCache.TryGetValue("estates", out estates)) |
136 | LoadEstateSettingsAll(); | 136 | estates = LoadEstateSettingsAll(); |
137 | 137 | ||
138 | List<int> eids = new List<int>(); | 138 | List<int> eids = new List<int>(); |
139 | foreach (EstateSettings es in estates) | 139 | foreach (EstateSettings es in estates) |
@@ -148,7 +148,7 @@ namespace OpenSim.Services.Connectors | |||
148 | // If we don't have them, load them from the server | 148 | // If we don't have them, load them from the server |
149 | List<EstateSettings> estates = null; | 149 | List<EstateSettings> estates = null; |
150 | if (!m_EstateCache.TryGetValue("estates", out estates)) | 150 | if (!m_EstateCache.TryGetValue("estates", out estates)) |
151 | LoadEstateSettingsAll(); | 151 | estates = LoadEstateSettingsAll(); |
152 | 152 | ||
153 | List<int> eids = new List<int>(); | 153 | List<int> eids = new List<int>(); |
154 | foreach (EstateSettings es in estates) | 154 | foreach (EstateSettings es in estates) |
@@ -323,7 +323,7 @@ namespace OpenSim.Services.Connectors | |||
323 | } | 323 | } |
324 | else | 324 | else |
325 | m_log.Error(string.Format( | 325 | m_log.Error(string.Format( |
326 | "[ESTATE CONNECTOR]: WebException for {0} {1} {2} ", | 326 | "[ESTATE CONNECTOR]: WebException for {0} {1} {2} {3}", |
327 | verb, uri, formdata, e)); | 327 | verb, uri, formdata, e)); |
328 | } | 328 | } |
329 | } | 329 | } |
diff --git a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs index b7702a8..873b554 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServicesConnector.cs | |||
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Friends | |||
86 | 86 | ||
87 | 87 | ||
88 | #region IFriendsService | 88 | #region IFriendsService |
89 | 89 | ||
90 | public FriendInfo[] GetFriends(UUID PrincipalID) | 90 | public FriendInfo[] GetFriends(UUID PrincipalID) |
91 | { | 91 | { |
92 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 92 | 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..74cd703 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, 15, null, false); |
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 596f867..ded7806 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,13 @@ 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 | GridRegion rinfo = null; | ||
282 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
283 | |||
284 | // this cache includes NULL regions | ||
285 | if (m_regionCache.TryGetValue(regionHandle, out rinfo)) | ||
286 | return rinfo; | ||
287 | |||
278 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 288 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
279 | 289 | ||
280 | sendData["SCOPEID"] = scopeID.ToString(); | 290 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -296,7 +306,6 @@ namespace OpenSim.Services.Connectors | |||
296 | return null; | 306 | return null; |
297 | } | 307 | } |
298 | 308 | ||
299 | GridRegion rinfo = null; | ||
300 | if (reply != string.Empty) | 309 | if (reply != string.Empty) |
301 | { | 310 | { |
302 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 311 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
@@ -316,6 +325,8 @@ namespace OpenSim.Services.Connectors | |||
316 | else | 325 | else |
317 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 326 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
318 | 327 | ||
328 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
329 | |||
319 | return rinfo; | 330 | return rinfo; |
320 | } | 331 | } |
321 | 332 | ||
@@ -672,7 +683,7 @@ namespace OpenSim.Services.Connectors | |||
672 | 683 | ||
673 | return rinfos; | 684 | return rinfos; |
674 | } | 685 | } |
675 | 686 | ||
676 | public int GetRegionFlags(UUID scopeID, UUID regionID) | 687 | public int GetRegionFlags(UUID scopeID, UUID regionID) |
677 | { | 688 | { |
678 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 689 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
@@ -744,7 +755,7 @@ namespace OpenSim.Services.Connectors | |||
744 | if (reply != string.Empty) | 755 | if (reply != string.Empty) |
745 | { | 756 | { |
746 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | 757 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); |
747 | 758 | ||
748 | if ((replyData != null) && replyData.Count > 0) | 759 | if ((replyData != null) && replyData.Count > 0) |
749 | { | 760 | { |
750 | foreach (string key in replyData.Keys) | 761 | foreach (string key in replyData.Keys) |
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index b1663ee..e814c45 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -73,13 +73,15 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
73 | return "foreignobject/"; | 73 | return "foreignobject/"; |
74 | } | 74 | } |
75 | 75 | ||
76 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason) | 76 | public bool LinkRegion(GridRegion info, out UUID regionID, out ulong realHandle, out string externalName, out string imageURL, out string reason, out int sizeX, out int sizeY) |
77 | { | 77 | { |
78 | regionID = UUID.Zero; | 78 | regionID = UUID.Zero; |
79 | imageURL = string.Empty; | 79 | imageURL = string.Empty; |
80 | realHandle = 0; | 80 | realHandle = 0; |
81 | externalName = string.Empty; | 81 | externalName = string.Empty; |
82 | reason = string.Empty; | 82 | reason = string.Empty; |
83 | sizeX = (int)Constants.RegionSize; | ||
84 | sizeY = (int)Constants.RegionSize; | ||
83 | 85 | ||
84 | Hashtable hash = new Hashtable(); | 86 | Hashtable hash = new Hashtable(); |
85 | hash["region_name"] = info.RegionName; | 87 | hash["region_name"] = info.RegionName; |
@@ -134,8 +136,15 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
134 | externalName = (string)hash["external_name"]; | 136 | externalName = (string)hash["external_name"]; |
135 | //m_log.Debug(">> HERE, externalName: " + externalName); | 137 | //m_log.Debug(">> HERE, externalName: " + externalName); |
136 | } | 138 | } |
139 | if (hash["size_x"] != null) | ||
140 | { | ||
141 | Int32.TryParse((string)hash["size_x"], out sizeX); | ||
142 | } | ||
143 | if (hash["size_y"] != null) | ||
144 | { | ||
145 | Int32.TryParse((string)hash["size_y"], out sizeY); | ||
146 | } | ||
137 | } | 147 | } |
138 | |||
139 | } | 148 | } |
140 | catch (Exception e) | 149 | catch (Exception e) |
141 | { | 150 | { |
@@ -160,14 +169,15 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
160 | 169 | ||
161 | try | 170 | try |
162 | { | 171 | { |
163 | WebClient c = new WebClient(); | 172 | //m_log.Debug("JPEG: " + imageURL); |
164 | string name = regionID.ToString(); | 173 | string name = regionID.ToString(); |
165 | filename = Path.Combine(storagePath, name + ".jpg"); | 174 | filename = Path.Combine(storagePath, name + ".jpg"); |
166 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); | 175 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: Map image at {0}, cached at {1}", imageURL, filename); |
167 | if (!File.Exists(filename)) | 176 | if (!File.Exists(filename)) |
168 | { | 177 | { |
169 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading..."); | 178 | m_log.DebugFormat("[GATEKEEPER SERVICE CONNECTOR]: downloading..."); |
170 | c.DownloadFile(imageURL, filename); | 179 | using(WebClient c = new WebClient()) |
180 | c.DownloadFile(imageURL, filename); | ||
171 | } | 181 | } |
172 | else | 182 | else |
173 | { | 183 | { |
@@ -189,11 +199,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
189 | 199 | ||
190 | ass.Data = imageData; | 200 | ass.Data = imageData; |
191 | 201 | ||
192 | mapTile = ass.FullID; | ||
193 | |||
194 | // finally | ||
195 | m_AssetService.Store(ass); | 202 | m_AssetService.Store(ass); |
196 | 203 | ||
204 | // finally | ||
205 | mapTile = ass.FullID; | ||
197 | } | 206 | } |
198 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke | 207 | catch // LEGIT: Catching problems caused by OpenJPEG p/invoke |
199 | { | 208 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs index 622d4e1..8b31fa2 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServicesConnector.cs | |||
@@ -277,7 +277,10 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
277 | { | 277 | { |
278 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | 278 | reply = SynchronousRestFormsRequester.MakeRequest("POST", |
279 | uri, | 279 | uri, |
280 | ServerUtils.BuildQueryString(sendData), 15); | 280 | ServerUtils.BuildQueryString(sendData), |
281 | 15, | ||
282 | null, | ||
283 | false); | ||
281 | } | 284 | } |
282 | catch (Exception e) | 285 | catch (Exception e) |
283 | { | 286 | { |
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index b5e6d69..91e1740 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs | |||
@@ -33,7 +33,7 @@ using Nini.Config; | |||
33 | 33 | ||
34 | namespace OpenSim.Services.Connectors | 34 | namespace OpenSim.Services.Connectors |
35 | { | 35 | { |
36 | public class HeloServicesConnector | 36 | public class HeloServicesConnector |
37 | { | 37 | { |
38 | private static readonly ILog m_log = | 38 | private static readonly ILog m_log = |
39 | LogManager.GetLogger( | 39 | LogManager.GetLogger( |
diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 8abd046..f2bb52a 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs | |||
@@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
70 | { | 70 | { |
71 | Uri m_Uri = new Uri(m_ServerURL); | 71 | Uri m_Uri = new Uri(m_ServerURL); |
72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); | 72 | IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); |
73 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); | 73 | if(ip != null) |
74 | if (!m_ServerURL.EndsWith("/")) | 74 | { |
75 | m_ServerURL += "/"; | 75 | m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); |
76 | if (!m_ServerURL.EndsWith("/")) | ||
77 | m_ServerURL += "/"; | ||
78 | } | ||
79 | else | ||
80 | m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url); | ||
76 | } | 81 | } |
77 | catch (Exception e) | 82 | catch (Exception e) |
78 | { | 83 | { |
@@ -113,7 +118,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
113 | return "homeagent/"; | 118 | return "homeagent/"; |
114 | } | 119 | } |
115 | 120 | ||
116 | // The Login service calls this interface with fromLogin=true | 121 | // The Login service calls this interface with fromLogin=true |
117 | // Sims call it with fromLogin=false | 122 | // Sims call it with fromLogin=false |
118 | // Either way, this is verified by the handler | 123 | // Either way, this is verified by the handler |
119 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason) | 124 | public bool LoginAgentToGrid(GridRegion source, AgentCircuitData aCircuit, GridRegion gatekeeper, GridRegion destination, bool fromLogin, out string reason) |
@@ -138,7 +143,8 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
138 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); | 143 | Console.WriteLine(" >>> LoginAgentToGrid <<< " + home.ServerURI); |
139 | 144 | ||
140 | uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; | 145 | uint flags = fromLogin ? (uint)TeleportFlags.ViaLogin : (uint)TeleportFlags.ViaHome; |
141 | return CreateAgent(source, home, aCircuit, flags, out reason); | 146 | EntityTransferContext ctx = new EntityTransferContext(); |
147 | return CreateAgent(source, home, aCircuit, flags, ctx, out reason); | ||
142 | } | 148 | } |
143 | 149 | ||
144 | 150 | ||
@@ -158,7 +164,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
158 | } | 164 | } |
159 | 165 | ||
160 | public void SetClientToken(UUID sessionID, string token) | 166 | public void SetClientToken(UUID sessionID, string token) |
161 | { | 167 | { |
162 | // no-op | 168 | // no-op |
163 | } | 169 | } |
164 | 170 | ||
@@ -415,7 +421,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
415 | 421 | ||
416 | XmlRpcRequest request = new XmlRpcRequest("get_online_friends", paramList); | 422 | XmlRpcRequest request = new XmlRpcRequest("get_online_friends", paramList); |
417 | // string reason = string.Empty; | 423 | // string reason = string.Empty; |
418 | 424 | ||
419 | // Send and get reply | 425 | // Send and get reply |
420 | List<UUID> online = new List<UUID>(); | 426 | List<UUID> online = new List<UUID>(); |
421 | XmlRpcResponse response = null; | 427 | XmlRpcResponse response = null; |
@@ -496,7 +502,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
496 | hash["userID"] = userID.ToString(); | 502 | hash["userID"] = userID.ToString(); |
497 | 503 | ||
498 | hash = CallServer("get_server_urls", hash); | 504 | hash = CallServer("get_server_urls", hash); |
499 | 505 | ||
500 | Dictionary<string, object> serverURLs = new Dictionary<string, object>(); | 506 | Dictionary<string, object> serverURLs = new Dictionary<string, object>(); |
501 | foreach (object key in hash.Keys) | 507 | foreach (object key in hash.Keys) |
502 | { | 508 | { |
@@ -515,7 +521,7 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
515 | Hashtable hash = new Hashtable(); | 521 | Hashtable hash = new Hashtable(); |
516 | hash["userID"] = userID.ToString(); | 522 | hash["userID"] = userID.ToString(); |
517 | 523 | ||
518 | hash = CallServer("locate_user", hash); | 524 | hash = CallServer("locate_user", hash); |
519 | 525 | ||
520 | string url = string.Empty; | 526 | string url = string.Empty; |
521 | 527 | ||
@@ -571,7 +577,11 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
571 | XmlRpcResponse response = null; | 577 | XmlRpcResponse response = null; |
572 | try | 578 | try |
573 | { | 579 | { |
574 | response = request.Send(m_ServerURL, 10000); | 580 | // We can not use m_ServerURL here anymore because it causes |
581 | // the HTTP request to be built without a host name. This messes | ||
582 | // with OSGrid's NGINX and can make OSGrid avatars unable to TP | ||
583 | // to other grids running recent mono. | ||
584 | response = request.Send(m_ServerURLHost, 10000); | ||
575 | } | 585 | } |
576 | catch (Exception e) | 586 | catch (Exception e) |
577 | { | 587 | { |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 7cecd93..dcf25ad 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs | |||
@@ -54,6 +54,8 @@ namespace OpenSim.Services.Connectors | |||
54 | 54 | ||
55 | private string m_ServerURI = String.Empty; | 55 | private string m_ServerURI = String.Empty; |
56 | 56 | ||
57 | private int m_maxRetries = 0; | ||
58 | |||
57 | /// <summary> | 59 | /// <summary> |
58 | /// Timeout for remote requests. | 60 | /// Timeout for remote requests. |
59 | /// </summary> | 61 | /// </summary> |
@@ -61,6 +63,7 @@ namespace OpenSim.Services.Connectors | |||
61 | /// In this case, -1 is default timeout (100 seconds), not infinite. | 63 | /// In this case, -1 is default timeout (100 seconds), not infinite. |
62 | /// </remarks> | 64 | /// </remarks> |
63 | private int m_requestTimeoutSecs = -1; | 65 | private int m_requestTimeoutSecs = -1; |
66 | private string m_configName = "InventoryService"; | ||
64 | 67 | ||
65 | private const double CACHE_EXPIRATION_SECONDS = 20.0; | 68 | private const double CACHE_EXPIRATION_SECONDS = 20.0; |
66 | private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>(); | 69 | private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache = new ExpiringCache<UUID,InventoryItemBase>(); |
@@ -74,6 +77,13 @@ namespace OpenSim.Services.Connectors | |||
74 | m_ServerURI = serverURI.TrimEnd('/'); | 77 | m_ServerURI = serverURI.TrimEnd('/'); |
75 | } | 78 | } |
76 | 79 | ||
80 | public XInventoryServicesConnector(IConfigSource source, string configName) | ||
81 | : base(source, configName) | ||
82 | { | ||
83 | m_configName = configName; | ||
84 | Initialise(source); | ||
85 | } | ||
86 | |||
77 | public XInventoryServicesConnector(IConfigSource source) | 87 | public XInventoryServicesConnector(IConfigSource source) |
78 | : base(source, "InventoryService") | 88 | : base(source, "InventoryService") |
79 | { | 89 | { |
@@ -82,10 +92,10 @@ namespace OpenSim.Services.Connectors | |||
82 | 92 | ||
83 | public virtual void Initialise(IConfigSource source) | 93 | public virtual void Initialise(IConfigSource source) |
84 | { | 94 | { |
85 | IConfig config = source.Configs["InventoryService"]; | 95 | IConfig config = source.Configs[m_configName]; |
86 | if (config == null) | 96 | if (config == null) |
87 | { | 97 | { |
88 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | 98 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: {0} missing from OpenSim.ini", m_configName); |
89 | throw new Exception("Inventory connector init error"); | 99 | throw new Exception("Inventory connector init error"); |
90 | } | 100 | } |
91 | 101 | ||
@@ -100,16 +110,17 @@ namespace OpenSim.Services.Connectors | |||
100 | m_ServerURI = serviceURI; | 110 | m_ServerURI = serviceURI; |
101 | 111 | ||
102 | m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); | 112 | m_requestTimeoutSecs = config.GetInt("RemoteRequestTimeout", m_requestTimeoutSecs); |
113 | m_maxRetries = config.GetInt("MaxRetries", m_maxRetries); | ||
103 | 114 | ||
104 | StatsManager.RegisterStat( | 115 | StatsManager.RegisterStat( |
105 | new Stat( | 116 | new Stat( |
106 | "RequestsMade", | 117 | "RequestsMade", |
107 | "Requests made", | 118 | "Requests made", |
108 | "Number of requests made to the remove inventory service", | 119 | "Number of requests made to the remove inventory service", |
109 | "requests", | 120 | "requests", |
110 | "inventory", | 121 | "inventory", |
111 | serviceURI, | 122 | serviceURI, |
112 | StatType.Pull, | 123 | StatType.Pull, |
113 | MeasuresOfInterest.AverageChangeOverTime, | 124 | MeasuresOfInterest.AverageChangeOverTime, |
114 | s => s.Value = RequestsMade, | 125 | s => s.Value = RequestsMade, |
115 | StatVerbosity.Debug)); | 126 | StatVerbosity.Debug)); |
@@ -240,7 +251,7 @@ namespace OpenSim.Services.Connectors | |||
240 | 251 | ||
241 | return inventory; | 252 | return inventory; |
242 | } | 253 | } |
243 | 254 | ||
244 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) | 255 | public virtual InventoryCollection[] GetMultipleFoldersContent(UUID principalID, UUID[] folderIDs) |
245 | { | 256 | { |
246 | InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length]; | 257 | InventoryCollection[] inventoryArr = new InventoryCollection[folderIDs.Length]; |
@@ -520,10 +531,10 @@ namespace OpenSim.Services.Connectors | |||
520 | return CheckReturn(ret); | 531 | return CheckReturn(ret); |
521 | } | 532 | } |
522 | 533 | ||
523 | public InventoryItemBase GetItem(InventoryItemBase item) | 534 | public InventoryItemBase GetItem(UUID principalID, UUID itemID) |
524 | { | 535 | { |
525 | InventoryItemBase retrieved = null; | 536 | InventoryItemBase retrieved = null; |
526 | if (m_ItemCache.TryGetValue(item.ID, out retrieved)) | 537 | if (m_ItemCache.TryGetValue(itemID, out retrieved)) |
527 | { | 538 | { |
528 | return retrieved; | 539 | return retrieved; |
529 | } | 540 | } |
@@ -532,7 +543,8 @@ namespace OpenSim.Services.Connectors | |||
532 | { | 543 | { |
533 | Dictionary<string, object> ret = MakeRequest("GETITEM", | 544 | Dictionary<string, object> ret = MakeRequest("GETITEM", |
534 | new Dictionary<string, object> { | 545 | new Dictionary<string, object> { |
535 | { "ID", item.ID.ToString() } | 546 | { "ID", itemID.ToString() }, |
547 | { "PRINCIPAL", principalID.ToString() } | ||
536 | }); | 548 | }); |
537 | 549 | ||
538 | if (!CheckReturn(ret)) | 550 | if (!CheckReturn(ret)) |
@@ -545,7 +557,7 @@ namespace OpenSim.Services.Connectors | |||
545 | m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); | 557 | m_log.Error("[XINVENTORY SERVICES CONNECTOR]: Exception in GetItem: ", e); |
546 | } | 558 | } |
547 | 559 | ||
548 | m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); | 560 | m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS); |
549 | 561 | ||
550 | return retrieved; | 562 | return retrieved; |
551 | } | 563 | } |
@@ -559,6 +571,7 @@ namespace OpenSim.Services.Connectors | |||
559 | List<UUID> pending = new List<UUID>(); | 571 | List<UUID> pending = new List<UUID>(); |
560 | InventoryItemBase item = null; | 572 | InventoryItemBase item = null; |
561 | int i = 0; | 573 | int i = 0; |
574 | |||
562 | foreach (UUID id in itemIDs) | 575 | foreach (UUID id in itemIDs) |
563 | { | 576 | { |
564 | if (m_ItemCache.TryGetValue(id, out item)) | 577 | if (m_ItemCache.TryGetValue(id, out item)) |
@@ -612,13 +625,14 @@ namespace OpenSim.Services.Connectors | |||
612 | return itemArr; | 625 | return itemArr; |
613 | } | 626 | } |
614 | 627 | ||
615 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 628 | public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) |
616 | { | 629 | { |
617 | try | 630 | try |
618 | { | 631 | { |
619 | Dictionary<string, object> ret = MakeRequest("GETFOLDER", | 632 | Dictionary<string, object> ret = MakeRequest("GETFOLDER", |
620 | new Dictionary<string, object> { | 633 | new Dictionary<string, object> { |
621 | { "ID", folder.ID.ToString() } | 634 | { "ID", folderID.ToString() }, |
635 | { "PRINCIPAL", principalID.ToString() } | ||
622 | }); | 636 | }); |
623 | 637 | ||
624 | if (!CheckReturn(ret)) | 638 | if (!CheckReturn(ret)) |
@@ -660,7 +674,7 @@ namespace OpenSim.Services.Connectors | |||
660 | { "ASSET", assetID.ToString() } | 674 | { "ASSET", assetID.ToString() } |
661 | }); | 675 | }); |
662 | 676 | ||
663 | // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int | 677 | // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int |
664 | if (ret == null) | 678 | if (ret == null) |
665 | return 0; | 679 | return 0; |
666 | 680 | ||
@@ -697,11 +711,21 @@ namespace OpenSim.Services.Connectors | |||
697 | 711 | ||
698 | RequestsMade++; | 712 | RequestsMade++; |
699 | 713 | ||
700 | string reply | 714 | string reply = String.Empty; |
701 | = SynchronousRestFormsRequester.MakeRequest( | 715 | int retries = 0; |
716 | |||
717 | do | ||
718 | { | ||
719 | reply = SynchronousRestFormsRequester.MakeRequest( | ||
702 | "POST", m_ServerURI + "/xinventory", | 720 | "POST", m_ServerURI + "/xinventory", |
703 | ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); | 721 | ServerUtils.BuildQueryString(sendData), m_requestTimeoutSecs, m_Auth); |
704 | 722 | ||
723 | if (reply != String.Empty) | ||
724 | break; | ||
725 | |||
726 | retries++; | ||
727 | } while (retries <= m_maxRetries); | ||
728 | |||
705 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( | 729 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse( |
706 | reply); | 730 | reply); |
707 | 731 | ||
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 034c42e..5492e83 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs | |||
@@ -66,22 +66,31 @@ namespace OpenSim.Services.Connectors | |||
66 | public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) | 66 | public virtual LandData GetLandData(UUID scopeID, ulong regionHandle, uint x, uint y, out byte regionAccess) |
67 | { | 67 | { |
68 | LandData landData = null; | 68 | LandData landData = null; |
69 | Hashtable hash = new Hashtable(); | ||
70 | hash["region_handle"] = regionHandle.ToString(); | ||
71 | hash["x"] = x.ToString(); | ||
72 | hash["y"] = y.ToString(); | ||
73 | 69 | ||
74 | IList paramList = new ArrayList(); | 70 | IList paramList = new ArrayList(); |
75 | paramList.Add(hash); | ||
76 | regionAccess = 42; // Default to adult. Better safe... | 71 | regionAccess = 42; // Default to adult. Better safe... |
77 | 72 | ||
78 | try | 73 | try |
79 | { | 74 | { |
80 | uint xpos = 0, ypos = 0; | 75 | uint xpos = 0, ypos = 0; |
81 | Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); | 76 | Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); |
77 | |||
82 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); | 78 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); |
83 | if (info != null) // just to be sure | 79 | if (info != null) // just to be sure |
84 | { | 80 | { |
81 | string targetHandlestr = info.RegionHandle.ToString(); | ||
82 | if( ypos == 0 ) //HG proxy? | ||
83 | { | ||
84 | // this is real region handle on hg proxies hack | ||
85 | targetHandlestr = info.RegionSecret; | ||
86 | } | ||
87 | |||
88 | Hashtable hash = new Hashtable(); | ||
89 | hash["region_handle"] = targetHandlestr; | ||
90 | hash["x"] = x.ToString(); | ||
91 | hash["y"] = y.ToString(); | ||
92 | paramList.Add(hash); | ||
93 | |||
85 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); | 94 | XmlRpcRequest request = new XmlRpcRequest("land_data", paramList); |
86 | XmlRpcResponse response = request.Send(info.ServerURI, 10000); | 95 | XmlRpcResponse response = request.Send(info.ServerURI, 10000); |
87 | if (response.IsFault) | 96 | if (response.IsFault) |
@@ -108,17 +117,19 @@ namespace OpenSim.Services.Connectors | |||
108 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); | 117 | landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); |
109 | if (hash["RegionAccess"] != null) | 118 | if (hash["RegionAccess"] != null) |
110 | regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]); | 119 | regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]); |
120 | if(hash["Dwell"] != null) | ||
121 | landData.Dwell = Convert.ToSingle((string)hash["Dwell"]); | ||
111 | m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name); | 122 | m_log.DebugFormat("[LAND CONNECTOR]: Got land data for parcel {0}", landData.Name); |
112 | } | 123 | } |
113 | catch (Exception e) | 124 | catch (Exception e) |
114 | { | 125 | { |
115 | m_log.ErrorFormat( | 126 | m_log.ErrorFormat( |
116 | "[LAND CONNECTOR]: Got exception while parsing land-data: {0} {1}", | 127 | "[LAND CONNECTOR]: Got exception while parsing land-data: {0} {1}", |
117 | e.Message, e.StackTrace); | 128 | e.Message, e.StackTrace); |
118 | } | 129 | } |
119 | } | 130 | } |
120 | } | 131 | } |
121 | else | 132 | else |
122 | m_log.WarnFormat("[LAND CONNECTOR]: Couldn't find region with handle {0}", regionHandle); | 133 | m_log.WarnFormat("[LAND CONNECTOR]: Couldn't find region with handle {0}", regionHandle); |
123 | } | 134 | } |
124 | catch (Exception e) | 135 | catch (Exception e) |
@@ -126,8 +137,8 @@ namespace OpenSim.Services.Connectors | |||
126 | m_log.ErrorFormat( | 137 | m_log.ErrorFormat( |
127 | "[LAND CONNECTOR]: Couldn't contact region {0}: {1} {2}", regionHandle, e.Message, e.StackTrace); | 138 | "[LAND CONNECTOR]: Couldn't contact region {0}: {1} {2}", regionHandle, e.Message, e.StackTrace); |
128 | } | 139 | } |
129 | 140 | ||
130 | return landData; | 141 | return landData; |
131 | } | 142 | } |
132 | } | 143 | } |
133 | } \ No newline at end of file | 144 | } |
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index c91ed84..84c4efe 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/MuteList/MuteListServicesConnector.cs b/OpenSim/Services/Connectors/MuteList/MuteListServicesConnector.cs new file mode 100644 index 0000000..e574c1d --- /dev/null +++ b/OpenSim/Services/Connectors/MuteList/MuteListServicesConnector.cs | |||
@@ -0,0 +1,183 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.IO; | ||
32 | using System.Reflection; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | |||
36 | using OpenSim.Framework.ServiceAuth; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Services.Connectors | ||
43 | { | ||
44 | public class MuteListServicesConnector : BaseServiceConnector, IMuteListService | ||
45 | { | ||
46 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private string m_ServerURI = String.Empty; | ||
49 | |||
50 | public MuteListServicesConnector() | ||
51 | { | ||
52 | } | ||
53 | |||
54 | public MuteListServicesConnector(string serverURI) | ||
55 | { | ||
56 | m_ServerURI = serverURI.TrimEnd('/') + "/mutelist"; | ||
57 | } | ||
58 | |||
59 | public MuteListServicesConnector(IConfigSource source) | ||
60 | { | ||
61 | Initialise(source); | ||
62 | } | ||
63 | |||
64 | public virtual void Initialise(IConfigSource source) | ||
65 | { | ||
66 | IConfig gridConfig = source.Configs["MuteListService"]; | ||
67 | if (gridConfig == null) | ||
68 | { | ||
69 | m_log.Error("[MUTELIST CONNECTOR]: MuteListService missing from configuration"); | ||
70 | throw new Exception("MuteList connector init error"); | ||
71 | } | ||
72 | |||
73 | string serviceURI = gridConfig.GetString("MuteListServerURI", | ||
74 | String.Empty); | ||
75 | |||
76 | if (serviceURI == String.Empty) | ||
77 | { | ||
78 | m_log.Error("[GRID USER CONNECTOR]: No Server URI named in section GridUserService"); | ||
79 | throw new Exception("GridUser connector init error"); | ||
80 | } | ||
81 | m_ServerURI = serviceURI + "/mutelist";; | ||
82 | base.Initialise(source, "MuteListService"); | ||
83 | } | ||
84 | |||
85 | #region IMuteListService | ||
86 | public Byte[] MuteListRequest(UUID agentID, uint crc) | ||
87 | { | ||
88 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
89 | sendData["METHOD"] = "get"; | ||
90 | sendData["agentid"] = agentID.ToString(); | ||
91 | sendData["mutecrc"] = crc.ToString(); | ||
92 | |||
93 | try | ||
94 | { | ||
95 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, | ||
96 | ServerUtils.BuildQueryString(sendData), m_Auth); | ||
97 | if (reply != string.Empty) | ||
98 | { | ||
99 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
100 | |||
101 | if (replyData.ContainsKey("result")) | ||
102 | { | ||
103 | string datastr = replyData["result"].ToString(); | ||
104 | if(String.IsNullOrWhiteSpace(datastr)) | ||
105 | return null; | ||
106 | return Convert.FromBase64String(datastr); | ||
107 | } | ||
108 | else | ||
109 | m_log.DebugFormat("[MUTELIST CONNECTOR]: get reply data does not contain result field"); | ||
110 | } | ||
111 | else | ||
112 | m_log.DebugFormat("[MUTELIST CONNECTOR]: get received empty reply"); | ||
113 | } | ||
114 | catch (Exception e) | ||
115 | { | ||
116 | m_log.DebugFormat("[MUTELIST CONNECTOR]: Exception when contacting server at {0}: {1}", m_ServerURI, e.Message); | ||
117 | } | ||
118 | |||
119 | return null; | ||
120 | } | ||
121 | |||
122 | public bool UpdateMute(MuteData mute) | ||
123 | { | ||
124 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
125 | sendData["METHOD"] = "update"; | ||
126 | sendData["agentid"] = mute.AgentID.ToString(); | ||
127 | sendData["muteid"] = mute.MuteID.ToString(); | ||
128 | if(mute.MuteType != 0) | ||
129 | sendData["mutetype"] = mute.MuteType.ToString(); | ||
130 | if(mute.MuteFlags != 0) | ||
131 | sendData["muteflags"] = mute.MuteFlags.ToString(); | ||
132 | sendData["mutestamp"] = mute.Stamp.ToString(); | ||
133 | if(!String.IsNullOrEmpty(mute.MuteName)) | ||
134 | sendData["mutename"] = mute.MuteName; | ||
135 | |||
136 | return doSimplePost(ServerUtils.BuildQueryString(sendData), "update"); | ||
137 | } | ||
138 | |||
139 | public bool RemoveMute(UUID agentID, UUID muteID, string muteName) | ||
140 | { | ||
141 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
142 | sendData["METHOD"] = "delete"; | ||
143 | sendData["agentid"] = agentID.ToString(); | ||
144 | sendData["muteid"] = muteID.ToString(); | ||
145 | if(!String.IsNullOrEmpty(muteName)) | ||
146 | sendData["mutename"] = muteName; | ||
147 | |||
148 | return doSimplePost(ServerUtils.BuildQueryString(sendData), "remove"); | ||
149 | } | ||
150 | |||
151 | #endregion IMuteListService | ||
152 | |||
153 | private bool doSimplePost(string reqString, string meth) | ||
154 | { | ||
155 | try | ||
156 | { | ||
157 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString, m_Auth); | ||
158 | if (reply != string.Empty) | ||
159 | { | ||
160 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
161 | |||
162 | if (replyData.ContainsKey("result")) | ||
163 | { | ||
164 | if (replyData["result"].ToString().ToLower() == "success") | ||
165 | return true; | ||
166 | else | ||
167 | return false; | ||
168 | } | ||
169 | else | ||
170 | m_log.DebugFormat("[MUTELIST CONNECTOR]: {0} reply data does not contain result field", meth); | ||
171 | } | ||
172 | else | ||
173 | m_log.DebugFormat("[MUTELIST CONNECTOR]: {0} received empty reply", meth); | ||
174 | } | ||
175 | catch (Exception e) | ||
176 | { | ||
177 | m_log.DebugFormat("[MUTELIST CONNECTOR]: Exception when contacting server at {0}: {1}", m_ServerURI, e.Message); | ||
178 | } | ||
179 | |||
180 | return false; | ||
181 | } | ||
182 | } | ||
183 | } | ||
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 925364a..33b3866 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -151,11 +151,11 @@ namespace OpenSim.Services.Connectors | |||
151 | os.Write(buffer, 0, strBuffer.Length); //Send it | 151 | os.Write(buffer, 0, strBuffer.Length); //Send it |
152 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); | 152 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); |
153 | } | 153 | } |
154 | catch (Exception e) | 154 | catch (Exception /*e*/) |
155 | { | 155 | { |
156 | m_log.Warn(string.Format( | 156 | // m_log.WarnFormat( |
157 | "[NEIGHBOUR SERVICES CONNECTOR]: Unable to send HelloNeighbour from {0} to {1} (uri {2}). Exception {3} ", | 157 | // "[NEIGHBOUR SERVICE CONNCTOR]: Unable to send HelloNeighbour from {0} to {1}. Exception {2}{3}", |
158 | thisRegion.RegionName, region.RegionName, uri, e.Message), e); | 158 | // thisRegion.RegionName, region.RegionName, e.Message, e.StackTrace); |
159 | 159 | ||
160 | return false; | 160 | return false; |
161 | } | 161 | } |
@@ -183,8 +183,8 @@ namespace OpenSim.Services.Connectors | |||
183 | { | 183 | { |
184 | using (StreamReader sr = new StreamReader(s)) | 184 | using (StreamReader sr = new StreamReader(s)) |
185 | { | 185 | { |
186 | sr.ReadToEnd(); // just try to read | ||
186 | //reply = sr.ReadToEnd().Trim(); | 187 | //reply = sr.ReadToEnd().Trim(); |
187 | sr.ReadToEnd().Trim(); | ||
188 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | 188 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); |
189 | } | 189 | } |
190 | } | 190 | } |
diff --git a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs index b7e95c4..04a0c5e 100644 --- a/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs +++ b/OpenSim/Services/Connectors/Presence/PresenceServicesConnector.cs | |||
@@ -107,7 +107,7 @@ namespace OpenSim.Services.Connectors | |||
107 | { | 107 | { |
108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", | 108 | string reply = SynchronousRestFormsRequester.MakeRequest("POST", |
109 | uri, | 109 | uri, |
110 | reqString, | 110 | reqString, |
111 | m_Auth); | 111 | m_Auth); |
112 | if (reply != string.Empty) | 112 | if (reply != string.Empty) |
113 | { | 113 | { |
@@ -313,6 +313,74 @@ 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()); | ||
327 | } | ||
328 | |||
329 | return pinfo; | ||
330 | } | ||
331 | |||
332 | public PresenceInfo GetAgentByUser(UUID userID) | ||
333 | { | ||
334 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
335 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
336 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
337 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
338 | sendData["METHOD"] = "getagentbyuser"; | ||
339 | |||
340 | sendData["UserID"] = userID.ToString(); | ||
341 | |||
342 | string reply = string.Empty; | ||
343 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
344 | string uri = m_ServerURI + "/presence"; | ||
345 | // m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); | ||
346 | try | ||
347 | { | ||
348 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
349 | uri, | ||
350 | reqString, | ||
351 | m_Auth); | ||
352 | if (reply == null || (reply != null && reply == string.Empty)) | ||
353 | { | ||
354 | m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgentByUser received null or empty reply"); | ||
355 | return null; | ||
356 | } | ||
357 | } | ||
358 | catch (Exception e) | ||
359 | { | ||
360 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Exception when contacting presence server at {0}: {1}", uri, e.Message); | ||
361 | return null; | ||
362 | } | ||
363 | |||
364 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
365 | PresenceInfo pinfo = null; | ||
366 | |||
367 | if ((replyData != null) && replyData.ContainsKey("result") && (replyData["result"] != null)) | ||
368 | { | ||
369 | if (replyData["result"] is Dictionary<string, object>) | ||
370 | { | ||
371 | pinfo = new PresenceInfo((Dictionary<string, object>)replyData["result"]); | ||
372 | } | ||
373 | else | ||
374 | { | ||
375 | if (replyData["result"].ToString() == "null") | ||
376 | return null; | ||
377 | |||
378 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply (result not dictionary) received from presence server when querying for userID {0}", userID.ToString()); | ||
379 | } | ||
380 | } | ||
381 | else | ||
382 | { | ||
383 | m_log.DebugFormat("[PRESENCE CONNECTOR]: Invalid reply received from presence server when querying for userID {0}", userID.ToString()); | ||
316 | } | 384 | } |
317 | 385 | ||
318 | return pinfo; | 386 | return pinfo; |
@@ -355,7 +423,7 @@ namespace OpenSim.Services.Connectors | |||
355 | 423 | ||
356 | if (replyData != null) | 424 | if (replyData != null) |
357 | { | 425 | { |
358 | if (replyData.ContainsKey("result") && | 426 | if (replyData.ContainsKey("result") && |
359 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) | 427 | (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) |
360 | { | 428 | { |
361 | return new PresenceInfo[0]; | 429 | return new PresenceInfo[0]; |
diff --git a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs index c581a59..76d26d6 100644 --- a/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs +++ b/OpenSim/Services/Connectors/Properties/AssemblyInfo.cs | |||
@@ -2,7 +2,7 @@ | |||
2 | using System.Runtime.CompilerServices; | 2 | using System.Runtime.CompilerServices; |
3 | using System.Runtime.InteropServices; | 3 | using System.Runtime.InteropServices; |
4 | 4 | ||
5 | // General Information about an assembly is controlled through the following | 5 | // General Information about an assembly is controlled through the following |
6 | // set of attributes. Change these attribute values to modify the information | 6 | // set of attributes. Change these attribute values to modify the information |
7 | // associated with an assembly. | 7 | // associated with an assembly. |
8 | [assembly: AssemblyTitle("OpenSim.Services.Connectors")] | 8 | [assembly: AssemblyTitle("OpenSim.Services.Connectors")] |
@@ -14,8 +14,8 @@ using System.Runtime.InteropServices; | |||
14 | [assembly: AssemblyTrademark("")] | 14 | [assembly: AssemblyTrademark("")] |
15 | [assembly: AssemblyCulture("")] | 15 | [assembly: AssemblyCulture("")] |
16 | 16 | ||
17 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
18 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
19 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
20 | [assembly: ComVisible(false)] | 20 | [assembly: ComVisible(false)] |
21 | 21 | ||
@@ -25,9 +25,9 @@ using System.Runtime.InteropServices; | |||
25 | // Version information for an assembly consists of the following four values: | 25 | // Version information for an assembly consists of the following four values: |
26 | // | 26 | // |
27 | // Major Version | 27 | // Major Version |
28 | // Minor Version | 28 | // Minor Version |
29 | // Build Number | 29 | // Build Number |
30 | // Revision | 30 | // Revision |
31 | // | 31 | // |
32 | [assembly: AssemblyVersion("0.8.3.*")] | 32 | [assembly: AssemblyVersion(OpenSim.VersionInfo.AssemblyVersionNumber)] |
33 | 33 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 9ad4a7a..953bc2a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
55 | private static string ZeroID = UUID.Zero.ToString(); | 55 | private static string ZeroID = UUID.Zero.ToString(); |
56 | 56 | ||
57 | private string m_serverUrl = String.Empty; | 57 | private string m_serverUrl = String.Empty; |
58 | private IImprovedAssetCache m_cache; | 58 | private IAssetCache m_cache; |
59 | private bool m_Enabled = false; | 59 | private bool m_Enabled = false; |
60 | 60 | ||
61 | #region ISharedRegionModule | 61 | #region ISharedRegionModule |
@@ -65,7 +65,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
65 | { | 65 | { |
66 | if (m_cache == null) | 66 | if (m_cache == null) |
67 | { | 67 | { |
68 | IImprovedAssetCache cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | 68 | IAssetCache cache = scene.RequestModuleInterface<IAssetCache>(); |
69 | if (cache is ISharedRegionModule) | 69 | if (cache is ISharedRegionModule) |
70 | m_cache = cache; | 70 | m_cache = cache; |
71 | } | 71 | } |
@@ -77,7 +77,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
77 | public string Name { get { return "SimianAssetServiceConnector"; } } | 77 | public string Name { get { return "SimianAssetServiceConnector"; } } |
78 | public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAssetService>(this); } } | 78 | public void AddRegion(Scene scene) { if (m_Enabled) { scene.RegisterModuleInterface<IAssetService>(this); } } |
79 | public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAssetService>(this); } } | 79 | public void RemoveRegion(Scene scene) { if (m_Enabled) { scene.UnregisterModuleInterface<IAssetService>(this); } } |
80 | 80 | ||
81 | #endregion ISharedRegionModule | 81 | #endregion ISharedRegionModule |
82 | 82 | ||
83 | public SimianAssetServiceConnector(IConfigSource source) | 83 | public SimianAssetServiceConnector(IConfigSource source) |
@@ -136,19 +136,22 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
136 | // Cache fetch | 136 | // Cache fetch |
137 | if (m_cache != null) | 137 | if (m_cache != null) |
138 | { | 138 | { |
139 | AssetBase asset = m_cache.Get(id); | 139 | AssetBase asset; |
140 | if (!m_cache.Get(id, out asset)) | ||
141 | return null; | ||
140 | if (asset != null) | 142 | if (asset != null) |
141 | return asset; | 143 | return asset; |
142 | } | 144 | } |
143 | 145 | ||
144 | return SimianGetOperation(id); | 146 | return SimianGetOperation(id); |
145 | } | 147 | } |
146 | 148 | ||
147 | 149 | ||
148 | public AssetBase GetCached(string id) | 150 | public AssetBase GetCached(string id) |
149 | { | 151 | { |
152 | AssetBase asset; | ||
150 | if (m_cache != null) | 153 | if (m_cache != null) |
151 | return m_cache.Get(id); | 154 | m_cache.Get(id, out asset); |
152 | 155 | ||
153 | return null; | 156 | return null; |
154 | } | 157 | } |
@@ -169,7 +172,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
169 | // Cache fetch | 172 | // Cache fetch |
170 | if (m_cache != null) | 173 | if (m_cache != null) |
171 | { | 174 | { |
172 | AssetBase asset = m_cache.Get(id); | 175 | AssetBase asset; |
176 | if (!m_cache.Get(id, out asset)) | ||
177 | return null; | ||
173 | if (asset != null) | 178 | if (asset != null) |
174 | return asset.Metadata; | 179 | return asset.Metadata; |
175 | } | 180 | } |
@@ -177,7 +182,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
177 | // return GetRemoteMetadata(id); | 182 | // return GetRemoteMetadata(id); |
178 | return SimianGetMetadataOperation(id); | 183 | return SimianGetMetadataOperation(id); |
179 | } | 184 | } |
180 | 185 | ||
181 | public byte[] GetData(string id) | 186 | public byte[] GetData(string id) |
182 | { | 187 | { |
183 | if (String.IsNullOrEmpty(m_serverUrl)) | 188 | if (String.IsNullOrEmpty(m_serverUrl)) |
@@ -212,7 +217,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
212 | // Cache fetch | 217 | // Cache fetch |
213 | if (m_cache != null) | 218 | if (m_cache != null) |
214 | { | 219 | { |
215 | AssetBase asset = m_cache.Get(id); | 220 | AssetBase asset; |
221 | if (!m_cache.Get(id, out asset)) | ||
222 | return false; | ||
223 | |||
216 | if (asset != null) | 224 | if (asset != null) |
217 | { | 225 | { |
218 | handler(id, sender, asset); | 226 | handler(id, sender, asset); |
@@ -296,7 +304,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
296 | 304 | ||
297 | return SimianStoreOperation(asset); | 305 | return SimianStoreOperation(asset); |
298 | } | 306 | } |
299 | 307 | ||
300 | /// <summary> | 308 | /// <summary> |
301 | /// Update an asset's content | 309 | /// Update an asset's content |
302 | /// </summary> | 310 | /// </summary> |
@@ -344,7 +352,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
344 | 352 | ||
345 | return SimianDeleteOperation(id); | 353 | return SimianDeleteOperation(id); |
346 | } | 354 | } |
347 | 355 | ||
348 | #endregion IAssetService | 356 | #endregion IAssetService |
349 | 357 | ||
350 | #region SimianOperations | 358 | #region SimianOperations |
@@ -369,9 +377,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
369 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset; {0}",response["Message"].AsString()); | 377 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset; {0}",response["Message"].AsString()); |
370 | return false; | 378 | return false; |
371 | } | 379 | } |
372 | 380 | ||
373 | return true; | 381 | return true; |
374 | 382 | ||
375 | } | 383 | } |
376 | catch (Exception ex) | 384 | catch (Exception ex) |
377 | { | 385 | { |
@@ -400,7 +408,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
400 | { "Temporary", asset.Temporary ? "1" : "0" }, | 408 | { "Temporary", asset.Temporary ? "1" : "0" }, |
401 | { "Name", asset.Name } | 409 | { "Name", asset.Name } |
402 | }; | 410 | }; |
403 | 411 | ||
404 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 412 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
405 | if (! response["Success"].AsBoolean()) | 413 | if (! response["Success"].AsBoolean()) |
406 | { | 414 | { |
@@ -410,13 +418,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
410 | 418 | ||
411 | // asset.ID is always set before calling this function | 419 | // asset.ID is always set before calling this function |
412 | return asset.ID; | 420 | return asset.ID; |
413 | 421 | ||
414 | } | 422 | } |
415 | catch (Exception ex) | 423 | catch (Exception ex) |
416 | { | 424 | { |
417 | m_log.ErrorFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",ex.Message); | 425 | m_log.ErrorFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",ex.Message); |
418 | } | 426 | } |
419 | 427 | ||
420 | return null; | 428 | return null; |
421 | } | 429 | } |
422 | 430 | ||
@@ -427,12 +435,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
427 | /// <returns></returns> | 435 | /// <returns></returns> |
428 | private AssetBase SimianGetOperation(string id) | 436 | private AssetBase SimianGetOperation(string id) |
429 | { | 437 | { |
430 | try | 438 | try |
431 | { | 439 | { |
432 | NameValueCollection requestArgs = new NameValueCollection | 440 | NameValueCollection requestArgs = new NameValueCollection |
433 | { | 441 | { |
434 | { "RequestMethod", "xGetAsset" }, | 442 | { "RequestMethod", "xGetAsset" }, |
435 | { "ID", id } | 443 | { "ID", id } |
436 | }; | 444 | }; |
437 | 445 | ||
438 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 446 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
@@ -441,7 +449,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
441 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset; {0}",response["Message"].AsString()); | 449 | m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset; {0}",response["Message"].AsString()); |
442 | return null; | 450 | return null; |
443 | } | 451 | } |
444 | 452 | ||
445 | AssetBase asset = new AssetBase(); | 453 | AssetBase asset = new AssetBase(); |
446 | 454 | ||
447 | asset.ID = id; | 455 | asset.ID = id; |
@@ -475,7 +483,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
475 | NameValueCollection requestArgs = new NameValueCollection | 483 | NameValueCollection requestArgs = new NameValueCollection |
476 | { | 484 | { |
477 | { "RequestMethod", "xGetAssetMetadata" }, | 485 | { "RequestMethod", "xGetAssetMetadata" }, |
478 | { "ID", id } | 486 | { "ID", id } |
479 | }; | 487 | }; |
480 | 488 | ||
481 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 489 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
@@ -485,7 +493,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
485 | // m_log.DebugFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset metadata; {0}",response["Message"].AsString()); | 493 | // m_log.DebugFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset metadata; {0}",response["Message"].AsString()); |
486 | return null; | 494 | return null; |
487 | } | 495 | } |
488 | 496 | ||
489 | AssetMetadata metadata = new AssetMetadata(); | 497 | AssetMetadata metadata = new AssetMetadata(); |
490 | metadata.ID = id; | 498 | metadata.ID = id; |
491 | metadata.ContentType = response["ContentType"].AsString(); | 499 | metadata.ContentType = response["ContentType"].AsString(); |
@@ -620,7 +628,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
620 | // } | 628 | // } |
621 | 629 | ||
622 | // string errorMessage = null; | 630 | // string errorMessage = null; |
623 | 631 | ||
624 | // // Build the remote storage request | 632 | // // Build the remote storage request |
625 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | 633 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() |
626 | // { | 634 | // { |
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/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index a397740..34bb274 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | |||
@@ -146,13 +146,14 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
146 | userID,response["Message"].AsString()); | 146 | userID,response["Message"].AsString()); |
147 | return null; | 147 | return null; |
148 | } | 148 | } |
149 | 149 | ||
150 | // <summary> | 150 | // <summary> |
151 | // </summary> | 151 | // </summary> |
152 | // <param name=""></param> | 152 | // <param name=""></param> |
153 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) | 153 | public bool SetAppearance(UUID userID, AvatarAppearance appearance) |
154 | { | 154 | { |
155 | OSDMap map = appearance.Pack(); | 155 | EntityTransferContext ctx = new EntityTransferContext(); |
156 | OSDMap map = appearance.Pack(ctx); | ||
156 | if (map == null) | 157 | if (map == null) |
157 | { | 158 | { |
158 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); | 159 | m_log.WarnFormat("[SIMIAN AVATAR CONNECTOR]: Failed to encode appearance for {0}",userID); |
@@ -177,7 +178,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
177 | 178 | ||
178 | return success; | 179 | return success; |
179 | } | 180 | } |
180 | 181 | ||
181 | // <summary> | 182 | // <summary> |
182 | // </summary> | 183 | // </summary> |
183 | // <param name=""></param> | 184 | // <param name=""></param> |
@@ -218,7 +219,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
218 | appearance.AvatarHeight = (float)map["Height"].AsReal(); | 219 | appearance.AvatarHeight = (float)map["Height"].AsReal(); |
219 | 220 | ||
220 | AvatarData avatar = new AvatarData(appearance); | 221 | AvatarData avatar = new AvatarData(appearance); |
221 | 222 | ||
222 | // Get attachments | 223 | // Get attachments |
223 | map = null; | 224 | map = null; |
224 | try { map = OSDParser.DeserializeJson(response["LLAttachments"].AsString()) as OSDMap; } | 225 | try { map = OSDParser.DeserializeJson(response["LLAttachments"].AsString()) as OSDMap; } |
@@ -229,7 +230,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
229 | foreach (KeyValuePair<string, OSD> kvp in map) | 230 | foreach (KeyValuePair<string, OSD> kvp in map) |
230 | avatar.Data[kvp.Key] = kvp.Value.AsString(); | 231 | avatar.Data[kvp.Key] = kvp.Value.AsString(); |
231 | } | 232 | } |
232 | 233 | ||
233 | return avatar; | 234 | return avatar; |
234 | } | 235 | } |
235 | else | 236 | else |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs index 764e71f..49bd9a4 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianExternalCapsModule.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
55 | private bool m_enabled = true; | 55 | private bool m_enabled = true; |
56 | private Scene m_scene; | 56 | private Scene m_scene; |
57 | private String m_simianURL; | 57 | private String m_simianURL; |
58 | 58 | ||
59 | #region IRegionModule Members | 59 | #region IRegionModule Members |
60 | 60 | ||
61 | public string Name | 61 | public string Name |
@@ -65,10 +65,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
65 | 65 | ||
66 | public void Initialise(IConfigSource config) | 66 | public void Initialise(IConfigSource config) |
67 | { | 67 | { |
68 | try | 68 | try |
69 | { | 69 | { |
70 | IConfig m_config; | 70 | IConfig m_config; |
71 | 71 | ||
72 | if ((m_config = config.Configs["SimianExternalCaps"]) != null) | 72 | if ((m_config = config.Configs["SimianExternalCaps"]) != null) |
73 | { | 73 | { |
74 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); | 74 | m_enabled = m_config.GetBoolean("Enabled", m_enabled); |
@@ -97,10 +97,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
97 | public void Close() { } | 97 | public void Close() { } |
98 | 98 | ||
99 | public void AddRegion(Scene scene) | 99 | public void AddRegion(Scene scene) |
100 | { | 100 | { |
101 | if (! m_enabled) | 101 | if (! m_enabled) |
102 | return; | 102 | return; |
103 | 103 | ||
104 | m_scene = scene; | 104 | m_scene = scene; |
105 | m_scene.RegisterModuleInterface<IExternalCapsModule>(this); | 105 | m_scene.RegisterModuleInterface<IExternalCapsModule>(this); |
106 | } | 106 | } |
@@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
153 | subs["%USR%"] = agentID.ToString(); | 153 | subs["%USR%"] = agentID.ToString(); |
154 | subs["%CAP%"] = cap.ToString(); | 154 | subs["%CAP%"] = cap.ToString(); |
155 | subs["%SIM%"] = m_scene.RegionInfo.RegionID.ToString(); | 155 | subs["%SIM%"] = m_scene.RegionInfo.RegionID.ToString(); |
156 | 156 | ||
157 | caps.RegisterHandler(capName,ExpandSkeletonURL(urlSkel,subs)); | 157 | caps.RegisterHandler(capName,ExpandSkeletonURL(urlSkel,subs)); |
158 | return true; | 158 | return true; |
159 | } | 159 | } |
@@ -168,12 +168,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
168 | private String ExpandSkeletonURL(String urlSkel, Dictionary<String,String> subs) | 168 | private String ExpandSkeletonURL(String urlSkel, Dictionary<String,String> subs) |
169 | { | 169 | { |
170 | String result = urlSkel; | 170 | String result = urlSkel; |
171 | 171 | ||
172 | foreach (KeyValuePair<String,String> kvp in subs) | 172 | foreach (KeyValuePair<String,String> kvp in subs) |
173 | { | 173 | { |
174 | result = result.Replace(kvp.Key,kvp.Value); | 174 | result = result.Replace(kvp.Key,kvp.Value); |
175 | } | 175 | } |
176 | 176 | ||
177 | return result; | 177 | return result; |
178 | } | 178 | } |
179 | } | 179 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index a35d749..b29adb3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | |||
@@ -52,20 +52,20 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
52 | private IConfig m_config = null; | 52 | private IConfig m_config = null; |
53 | 53 | ||
54 | private String m_simianURL; | 54 | private String m_simianURL; |
55 | 55 | ||
56 | #region IRegionModule Members | 56 | #region IRegionModule Members |
57 | 57 | ||
58 | public string Name | 58 | public string Name |
59 | { | 59 | { |
60 | get { return this.GetType().Name; } | 60 | get { return this.GetType().Name; } |
61 | } | 61 | } |
62 | 62 | ||
63 | public void Initialise(IConfigSource config) | 63 | public void Initialise(IConfigSource config) |
64 | { | 64 | { |
65 | try | 65 | try |
66 | { | 66 | { |
67 | m_config = config.Configs["SimianGrid"]; | 67 | m_config = config.Configs["SimianGrid"]; |
68 | 68 | ||
69 | if (m_config != null) | 69 | if (m_config != null) |
70 | { | 70 | { |
71 | m_simianURL = m_config.GetString("SimianServiceURL"); | 71 | m_simianURL = m_config.GetString("SimianServiceURL"); |
@@ -74,7 +74,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
74 | // m_log.DebugFormat("[SimianGrid] service URL is not defined"); | 74 | // m_log.DebugFormat("[SimianGrid] service URL is not defined"); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
78 | InitialiseSimCap(); | 78 | InitialiseSimCap(); |
79 | SimulatorCapability = SimulatorCapability.Trim(); | 79 | SimulatorCapability = SimulatorCapability.Trim(); |
80 | m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability); | 80 | m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability); |
@@ -100,7 +100,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
100 | 100 | ||
101 | ///<summary> | 101 | ///<summary> |
102 | /// Try a variety of methods for finding the simian simulator capability; first check the | 102 | /// Try a variety of methods for finding the simian simulator capability; first check the |
103 | /// configuration itself, then look for a file that contains the cap, then finally look | 103 | /// configuration itself, then look for a file that contains the cap, then finally look |
104 | /// for an environment variable that contains it. | 104 | /// for an environment variable that contains it. |
105 | ///</summary> | 105 | ///</summary> |
106 | private void InitialiseSimCap() | 106 | private void InitialiseSimCap() |
@@ -110,7 +110,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
110 | SimulatorCapability = m_config.GetString("SimulatorCapability"); | 110 | SimulatorCapability = m_config.GetString("SimulatorCapability"); |
111 | return; | 111 | return; |
112 | } | 112 | } |
113 | 113 | ||
114 | if (m_config.Contains("SimulatorCapabilityFile")) | 114 | if (m_config.Contains("SimulatorCapabilityFile")) |
115 | { | 115 | { |
116 | String filename = m_config.GetString("SimulatorCapabilityFile"); | 116 | String filename = m_config.GetString("SimulatorCapabilityFile"); |
@@ -120,7 +120,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | if (m_config.Contains("SimulatorCapabilityVariable")) | 124 | if (m_config.Contains("SimulatorCapabilityVariable")) |
125 | { | 125 | { |
126 | String envname = m_config.GetString("SimulatorCapabilityVariable"); | 126 | String envname = m_config.GetString("SimulatorCapabilityVariable"); |
@@ -134,7 +134,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
134 | 134 | ||
135 | m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability"); | 135 | m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability"); |
136 | } | 136 | } |
137 | 137 | ||
138 | #endregion | 138 | #endregion |
139 | 139 | ||
140 | public static String SimulatorCapability = UUID.Zero.ToString(); | 140 | public static String SimulatorCapability = UUID.Zero.ToString(); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index 8375c95..4896d09 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs | |||
@@ -65,14 +65,14 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
65 | private int m_refreshtime = 0; | 65 | private int m_refreshtime = 0; |
66 | private int m_lastrefresh = 0; | 66 | private int m_lastrefresh = 0; |
67 | private System.Timers.Timer m_refreshTimer = new System.Timers.Timer(); | 67 | private System.Timers.Timer m_refreshTimer = new System.Timers.Timer(); |
68 | 68 | ||
69 | #region ISharedRegionModule | 69 | #region ISharedRegionModule |
70 | 70 | ||
71 | public Type ReplaceableInterface { get { return null; } } | 71 | public Type ReplaceableInterface { get { return null; } } |
72 | public string Name { get { return "SimianGridMaptile"; } } | 72 | public string Name { get { return "SimianGridMaptile"; } } |
73 | public void RegionLoaded(Scene scene) { } | 73 | public void RegionLoaded(Scene scene) { } |
74 | public void Close() { } | 74 | public void Close() { } |
75 | 75 | ||
76 | ///<summary> | 76 | ///<summary> |
77 | /// | 77 | /// |
78 | ///</summary> | 78 | ///</summary> |
@@ -81,7 +81,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
81 | IConfig config = source.Configs["SimianGridMaptiles"]; | 81 | IConfig config = source.Configs["SimianGridMaptiles"]; |
82 | if (config == null) | 82 | if (config == null) |
83 | return; | 83 | return; |
84 | 84 | ||
85 | if (! config.GetBoolean("Enabled", false)) | 85 | if (! config.GetBoolean("Enabled", false)) |
86 | return; | 86 | return; |
87 | 87 | ||
@@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
218 | { | 218 | { |
219 | uint locX = scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize); | 219 | uint locX = scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize); |
220 | uint locY = scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize); | 220 | uint locY = scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize); |
221 | 221 | ||
222 | ConvertAndUploadMaptile(subMapTile, locX, locY); | 222 | ConvertAndUploadMaptile(subMapTile, locX, locY); |
223 | } | 223 | } |
224 | } | 224 | } |
@@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
232 | } | 232 | } |
233 | 233 | ||
234 | } | 234 | } |
235 | 235 | ||
236 | ///<summary> | 236 | ///<summary> |
237 | /// | 237 | /// |
238 | ///</summary> | 238 | ///</summary> |
@@ -255,7 +255,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
255 | { "ContentType", "image/png" }, | 255 | { "ContentType", "image/png" }, |
256 | { "EncodedData", System.Convert.ToBase64String(pngData) } | 256 | { "EncodedData", System.Convert.ToBase64String(pngData) } |
257 | }; | 257 | }; |
258 | 258 | ||
259 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 259 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
260 | if (! response["Success"].AsBoolean()) | 260 | if (! response["Success"].AsBoolean()) |
261 | { | 261 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index b031f21..f8eebbe 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; |
@@ -89,7 +91,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
89 | m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); | 91 | m_log.Error("[SIMIAN GRID CONNECTOR]: No Server URI named in section GridService"); |
90 | throw new Exception("Grid connector init error"); | 92 | throw new Exception("Grid connector init error"); |
91 | } | 93 | } |
92 | 94 | ||
93 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) | 95 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) |
94 | serviceUrl = serviceUrl + '/'; | 96 | serviceUrl = serviceUrl + '/'; |
95 | m_ServerURI = serviceUrl; | 97 | m_ServerURI = serviceUrl; |
@@ -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) }, |
@@ -219,7 +230,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
219 | }; | 230 | }; |
220 | 231 | ||
221 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); | 232 | // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString()); |
222 | 233 | ||
223 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); | 234 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
224 | if (response["Success"].AsBoolean()) | 235 | if (response["Success"].AsBoolean()) |
225 | { | 236 | { |
@@ -297,7 +308,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
297 | }; | 308 | }; |
298 | 309 | ||
299 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); | 310 | //m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString()); |
300 | 311 | ||
301 | 312 | ||
302 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); | 313 | OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs); |
303 | if (response["Success"].AsBoolean()) | 314 | if (response["Success"].AsBoolean()) |
@@ -402,7 +413,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
402 | return -1; | 413 | return -1; |
403 | } | 414 | } |
404 | } | 415 | } |
405 | 416 | ||
406 | public Dictionary<string, object> GetExtraFeatures() | 417 | public Dictionary<string, object> GetExtraFeatures() |
407 | { | 418 | { |
408 | /// See SimulatorFeaturesModule - Need to get map, search and destination guide | 419 | /// See SimulatorFeaturesModule - Need to get map, search and destination guide |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index e793420..9eefd16 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -277,17 +277,17 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
277 | /// </summary> | 277 | /// </summary> |
278 | /// <param name="item"></param> | 278 | /// <param name="item"></param> |
279 | /// <returns></returns> | 279 | /// <returns></returns> |
280 | public InventoryItemBase GetItem(InventoryItemBase item) | 280 | public InventoryItemBase GetItem(UUID principalID, UUID itemID) |
281 | { | 281 | { |
282 | InventoryItemBase retrieved = null; | 282 | InventoryItemBase retrieved = null; |
283 | if (m_ItemCache.TryGetValue(item.ID, out retrieved)) | 283 | if (m_ItemCache.TryGetValue(itemID, out retrieved)) |
284 | return retrieved; | 284 | return retrieved; |
285 | 285 | ||
286 | NameValueCollection requestArgs = new NameValueCollection | 286 | NameValueCollection requestArgs = new NameValueCollection |
287 | { | 287 | { |
288 | { "RequestMethod", "GetInventoryNode" }, | 288 | { "RequestMethod", "GetInventoryNode" }, |
289 | { "ItemID", item.ID.ToString() }, | 289 | { "ItemID", itemID.ToString() }, |
290 | { "OwnerID", item.Owner.ToString() }, | 290 | { "OwnerID", principalID.ToString() }, |
291 | { "IncludeFolders", "1" }, | 291 | { "IncludeFolders", "1" }, |
292 | { "IncludeItems", "1" }, | 292 | { "IncludeItems", "1" }, |
293 | { "ChildrenOnly", "1" } | 293 | { "ChildrenOnly", "1" } |
@@ -303,17 +303,17 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
303 | // and sanity check just in case | 303 | // and sanity check just in case |
304 | for (int i = 0; i < items.Count; i++) | 304 | for (int i = 0; i < items.Count; i++) |
305 | { | 305 | { |
306 | if (items[i].ID == item.ID) | 306 | if (items[i].ID == itemID) |
307 | { | 307 | { |
308 | retrieved = items[i]; | 308 | retrieved = items[i]; |
309 | m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); | 309 | m_ItemCache.AddOrUpdate(itemID, retrieved, CACHE_EXPIRATION_SECONDS); |
310 | return retrieved; | 310 | return retrieved; |
311 | } | 311 | } |
312 | } | 312 | } |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + item.ID + " owned by " + item.Owner + " not found"); | 316 | m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Item " + itemID + " owned by " + principalID + " not found"); |
317 | return null; | 317 | return null; |
318 | } | 318 | } |
319 | 319 | ||
@@ -321,13 +321,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
321 | { | 321 | { |
322 | InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; | 322 | InventoryItemBase[] result = new InventoryItemBase[itemIDs.Length]; |
323 | int i = 0; | 323 | int i = 0; |
324 | InventoryItemBase item = new InventoryItemBase(); | ||
325 | item.Owner = principalID; | ||
326 | foreach (UUID id in itemIDs) | 324 | foreach (UUID id in itemIDs) |
327 | { | 325 | result[i++] = GetItem(principalID, id); |
328 | item.ID = id; | ||
329 | result[i++] = GetItem(item); | ||
330 | } | ||
331 | 326 | ||
332 | return result; | 327 | return result; |
333 | } | 328 | } |
@@ -337,13 +332,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
337 | /// </summary> | 332 | /// </summary> |
338 | /// <param name="folder"></param> | 333 | /// <param name="folder"></param> |
339 | /// <returns></returns> | 334 | /// <returns></returns> |
340 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | 335 | public InventoryFolderBase GetFolder(UUID principalID, UUID folderID) |
341 | { | 336 | { |
342 | NameValueCollection requestArgs = new NameValueCollection | 337 | NameValueCollection requestArgs = new NameValueCollection |
343 | { | 338 | { |
344 | { "RequestMethod", "GetInventoryNode" }, | 339 | { "RequestMethod", "GetInventoryNode" }, |
345 | { "ItemID", folder.ID.ToString() }, | 340 | { "ItemID", folderID.ToString() }, |
346 | { "OwnerID", folder.Owner.ToString() }, | 341 | { "OwnerID", principalID.ToString() }, |
347 | { "IncludeFolders", "1" }, | 342 | { "IncludeFolders", "1" }, |
348 | { "IncludeItems", "0" }, | 343 | { "IncludeItems", "0" }, |
349 | { "ChildrenOnly", "1" } | 344 | { "ChildrenOnly", "1" } |
@@ -353,7 +348,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
353 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) | 348 | if (response["Success"].AsBoolean() && response["Items"] is OSDArray) |
354 | { | 349 | { |
355 | OSDArray items = (OSDArray)response["Items"]; | 350 | OSDArray items = (OSDArray)response["Items"]; |
356 | List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folder.ID, true); | 351 | List<InventoryFolderBase> folders = GetFoldersFromResponse(items, folderID, true); |
357 | 352 | ||
358 | if (folders.Count > 0) | 353 | if (folders.Count > 0) |
359 | return folders[0]; | 354 | return folders[0]; |
@@ -540,7 +535,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
540 | allSuccess = false; | 535 | allSuccess = false; |
541 | } | 536 | } |
542 | } | 537 | } |
543 | 538 | ||
544 | return allSuccess; | 539 | return allSuccess; |
545 | } | 540 | } |
546 | 541 | ||
@@ -732,11 +727,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
732 | 727 | ||
733 | /// <summary> | 728 | /// <summary> |
734 | /// Get the union of permissions of all inventory items | 729 | /// Get the union of permissions of all inventory items |
735 | /// that hold the given assetID. | 730 | /// that hold the given assetID. |
736 | /// </summary> | 731 | /// </summary> |
737 | /// <param name="userID"></param> | 732 | /// <param name="userID"></param> |
738 | /// <param name="assetID"></param> | 733 | /// <param name="assetID"></param> |
739 | /// <returns>The permissions or 0 if no such asset is found in | 734 | /// <returns>The permissions or 0 if no such asset is found in |
740 | /// the user's inventory</returns> | 735 | /// the user's inventory</returns> |
741 | public int GetAssetPermissions(UUID userID, UUID assetID) | 736 | public int GetAssetPermissions(UUID userID, UUID assetID) |
742 | { | 737 | { |
@@ -792,7 +787,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
792 | if (item != null && item["Type"].AsString() == "Item") | 787 | if (item != null && item["Type"].AsString() == "Item") |
793 | { | 788 | { |
794 | InventoryItemBase invItem = new InventoryItemBase(); | 789 | InventoryItemBase invItem = new InventoryItemBase(); |
795 | 790 | ||
796 | invItem.AssetID = item["AssetID"].AsUUID(); | 791 | invItem.AssetID = item["AssetID"].AsUUID(); |
797 | invItem.AssetType = SLUtil.ContentTypeToSLAssetType(item["ContentType"].AsString()); | 792 | invItem.AssetType = SLUtil.ContentTypeToSLAssetType(item["ContentType"].AsString()); |
798 | invItem.CreationDate = item["CreationDate"].AsInteger(); | 793 | invItem.CreationDate = item["CreationDate"].AsInteger(); |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 211b775..2a34379 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs | |||
@@ -121,7 +121,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
121 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) | 121 | if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) |
122 | serviceUrl = serviceUrl + '/'; | 122 | serviceUrl = serviceUrl + '/'; |
123 | m_serverUrl = serviceUrl; | 123 | m_serverUrl = serviceUrl; |
124 | m_activityDetector = new SimianActivityDetector(this); | 124 | m_activityDetector = new SimianActivityDetector(this); |
125 | m_Enabled = true; | 125 | m_Enabled = true; |
126 | } | 126 | } |
127 | } | 127 | } |
@@ -210,7 +210,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
210 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session {0}: {1}",sessionID.ToString(),sessionResponse["Message"].AsString()); | 210 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session {0}: {1}",sessionID.ToString(),sessionResponse["Message"].AsString()); |
211 | return null; | 211 | return null; |
212 | } | 212 | } |
213 | 213 | ||
214 | UUID userID = sessionResponse["UserID"].AsUUID(); | 214 | UUID userID = sessionResponse["UserID"].AsUUID(); |
215 | OSDMap userResponse = GetUserData(userID); | 215 | OSDMap userResponse = GetUserData(userID); |
216 | if (userResponse == null) | 216 | if (userResponse == null) |
@@ -222,6 +222,18 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
222 | return ResponseToPresenceInfo(sessionResponse); | 222 | return ResponseToPresenceInfo(sessionResponse); |
223 | } | 223 | } |
224 | 224 | ||
225 | public PresenceInfo GetAgentByUser(UUID userID) | ||
226 | { | ||
227 | OSDMap userResponse = GetUserData(userID); | ||
228 | if (userResponse == null) | ||
229 | { | ||
230 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve user data for {0}: {1}",userID.ToString(),userResponse["Message"].AsString()); | ||
231 | return null; | ||
232 | } | ||
233 | |||
234 | return ResponseToPresenceInfo(userResponse); | ||
235 | } | ||
236 | |||
225 | public PresenceInfo[] GetAgents(string[] userIDs) | 237 | public PresenceInfo[] GetAgents(string[] userIDs) |
226 | { | 238 | { |
227 | List<PresenceInfo> presences = new List<PresenceInfo>(); | 239 | List<PresenceInfo> presences = new List<PresenceInfo>(); |
@@ -238,7 +250,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
238 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); | 250 | m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString()); |
239 | return null; | 251 | return null; |
240 | } | 252 | } |
241 | 253 | ||
242 | OSDArray sessionList = sessionListResponse["Sessions"] as OSDArray; | 254 | OSDArray sessionList = sessionListResponse["Sessions"] as OSDArray; |
243 | for (int i = 0; i < sessionList.Count; i++) | 255 | for (int i = 0; i < sessionList.Count; i++) |
244 | { | 256 | { |
@@ -311,7 +323,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
311 | 323 | ||
312 | public GridUserInfo GetGridUserInfo(string user) | 324 | public GridUserInfo GetGridUserInfo(string user) |
313 | { | 325 | { |
314 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); | 326 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for agent " + user); |
315 | 327 | ||
316 | UUID userID = new UUID(user); | 328 | UUID userID = new UUID(user); |
317 | OSDMap userResponse = GetUserData(userID); | 329 | OSDMap userResponse = GetUserData(userID); |
@@ -421,7 +433,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
421 | 433 | ||
422 | return null; | 434 | return null; |
423 | } | 435 | } |
424 | 436 | ||
425 | private string SerializeLocation(UUID regionID, Vector3 position, Vector3 lookAt) | 437 | private string SerializeLocation(UUID regionID, Vector3 position, Vector3 lookAt) |
426 | { | 438 | { |
427 | return "{" + String.Format("\"SceneID\":\"{0}\",\"Position\":\"{1}\",\"LookAt\":\"{2}\"", regionID, position, lookAt) + "}"; | 439 | return "{" + String.Format("\"SceneID\":\"{0}\",\"Position\":\"{1}\",\"LookAt\":\"{2}\"", regionID, position, lookAt) + "}"; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 8fc766d..a388bcc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
70 | private bool m_Enabled = false; | 70 | private bool m_Enabled = false; |
71 | 71 | ||
72 | #region INonSharedRegionModule | 72 | #region INonSharedRegionModule |
73 | 73 | ||
74 | public Type ReplaceableInterface { get { return null; } } | 74 | public Type ReplaceableInterface { get { return null; } } |
75 | public void RegionLoaded(Scene scene) { } | 75 | public void RegionLoaded(Scene scene) { } |
76 | public void Close() { } | 76 | public void Close() { } |
@@ -284,7 +284,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
284 | private void RequestAvatarPropertiesHandler(IClientAPI client, UUID avatarID) | 284 | private void RequestAvatarPropertiesHandler(IClientAPI client, UUID avatarID) |
285 | { | 285 | { |
286 | m_log.DebugFormat("[SIMIAN PROFILES]: Request avatar properties for {0}",avatarID); | 286 | m_log.DebugFormat("[SIMIAN PROFILES]: Request avatar properties for {0}",avatarID); |
287 | 287 | ||
288 | OSDMap user = FetchUserData(avatarID); | 288 | OSDMap user = FetchUserData(avatarID); |
289 | 289 | ||
290 | ProfileFlags flags = ProfileFlags.AllowPublish | ProfileFlags.MaturePublish; | 290 | ProfileFlags flags = ProfileFlags.AllowPublish | ProfileFlags.MaturePublish; |
@@ -308,11 +308,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
308 | about = new OSDMap(0); | 308 | about = new OSDMap(0); |
309 | 309 | ||
310 | // Check if this user is a grid operator | 310 | // Check if this user is a grid operator |
311 | byte[] charterMember; | 311 | byte[] membershipType; |
312 | if (user["AccessLevel"].AsInteger() >= 200) | 312 | if (user["AccessLevel"].AsInteger() >= 200) |
313 | charterMember = Utils.StringToBytes("Operator"); | 313 | membershipType = Utils.StringToBytes("Operator"); |
314 | else | 314 | else |
315 | charterMember = Utils.EmptyBytes; | 315 | membershipType = Utils.EmptyBytes; |
316 | 316 | ||
317 | // Check if the user is online | 317 | // Check if the user is online |
318 | if (client.Scene is Scene) | 318 | if (client.Scene is Scene) |
@@ -327,7 +327,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
327 | flags |= ProfileFlags.Identified; | 327 | flags |= ProfileFlags.Identified; |
328 | 328 | ||
329 | client.SendAvatarProperties(avatarID, about["About"].AsString(), user["CreationDate"].AsDate().ToString("M/d/yyyy", | 329 | client.SendAvatarProperties(avatarID, about["About"].AsString(), user["CreationDate"].AsDate().ToString("M/d/yyyy", |
330 | System.Globalization.CultureInfo.InvariantCulture), charterMember, about["FLAbout"].AsString(), (uint)flags, | 330 | System.Globalization.CultureInfo.InvariantCulture), membershipType, about["FLAbout"].AsString(), (uint)flags, |
331 | about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID()); | 331 | about["FLImage"].AsUUID(), about["Image"].AsUUID(), about["URL"].AsString(), user["Partner"].AsUUID()); |
332 | 332 | ||
333 | OSDMap interests = null; | 333 | OSDMap interests = null; |
@@ -455,7 +455,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
455 | private OSDMap FetchUserData(UUID userID) | 455 | private OSDMap FetchUserData(UUID userID) |
456 | { | 456 | { |
457 | m_log.DebugFormat("[SIMIAN PROFILES]: Fetch information about {0}",userID); | 457 | m_log.DebugFormat("[SIMIAN PROFILES]: Fetch information about {0}",userID); |
458 | 458 | ||
459 | NameValueCollection requestArgs = new NameValueCollection | 459 | NameValueCollection requestArgs = new NameValueCollection |
460 | { | 460 | { |
461 | { "RequestMethod", "GetUser" }, | 461 | { "RequestMethod", "GetUser" }, |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 698c4c0..115ae36 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -42,7 +42,7 @@ using OpenMetaverse.StructuredData; | |||
42 | namespace OpenSim.Services.Connectors.SimianGrid | 42 | namespace OpenSim.Services.Connectors.SimianGrid |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// Connects user account data (creating new users, looking up existing | 45 | /// Connects user account data (creating new users, looking up existing |
46 | /// users) to the SimianGrid backend | 46 | /// users) to the SimianGrid backend |
47 | /// </summary> | 47 | /// </summary> |
48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianUserAccountServiceConnector")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianUserAccountServiceConnector")] |
@@ -196,6 +196,16 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
196 | m_accountCache.Remove(userID); | 196 | m_accountCache.Remove(userID); |
197 | } | 197 | } |
198 | 198 | ||
199 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
200 | { | ||
201 | return null; | ||
202 | } | ||
203 | |||
204 | public List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
205 | { | ||
206 | return null; | ||
207 | } | ||
208 | |||
199 | public bool StoreUserAccount(UserAccount data) | 209 | public bool StoreUserAccount(UserAccount data) |
200 | { | 210 | { |
201 | // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); | 211 | // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); |
@@ -210,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
210 | }; | 220 | }; |
211 | 221 | ||
212 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); | 222 | OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs); |
213 | 223 | ||
214 | if (response["Success"].AsBoolean()) | 224 | if (response["Success"].AsBoolean()) |
215 | { | 225 | { |
216 | m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account data for " + data.Name); | 226 | m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account data for " + data.Name); |
@@ -295,7 +305,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
295 | account.LocalToGrid = true; | 305 | account.LocalToGrid = true; |
296 | if (response.ContainsKey("LocalToGrid")) | 306 | if (response.ContainsKey("LocalToGrid")) |
297 | account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false); | 307 | account.LocalToGrid = (response["LocalToGrid"].AsString() == "true" ? true : false); |
298 | 308 | ||
299 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); | 309 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); |
300 | 310 | ||
301 | // Cache the user account info | 311 | // Cache the user account info |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index cea870b..a4ca2d3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -50,7 +50,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
50 | 50 | ||
51 | // we use this dictionary to track the pending updateagent requests, maps URI --> position update | 51 | // we use this dictionary to track the pending updateagent requests, maps URI --> position update |
52 | private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>(); | 52 | private Dictionary<string,AgentPosition> m_updateAgentQueue = new Dictionary<string,AgentPosition>(); |
53 | 53 | ||
54 | //private GridRegion m_Region; | 54 | //private GridRegion m_Region; |
55 | 55 | ||
56 | public SimulationServiceConnector() | 56 | public SimulationServiceConnector() |
@@ -98,29 +98,32 @@ namespace OpenSim.Services.Connectors.Simulation | |||
98 | args["teleport_flags"] = OSD.FromString(flags.ToString()); | 98 | args["teleport_flags"] = OSD.FromString(flags.ToString()); |
99 | } | 99 | } |
100 | 100 | ||
101 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) | 101 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string reason) |
102 | { | 102 | { |
103 | string tmp = String.Empty; | 103 | string tmp = String.Empty; |
104 | return CreateAgent(source, destination, aCircuit, flags, out tmp, out reason); | 104 | return CreateAgent(source, destination, aCircuit, flags, ctx, out tmp, out reason); |
105 | } | 105 | } |
106 | 106 | ||
107 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, out string myipaddress, out string reason) | 107 | public bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint flags, EntityTransferContext ctx, out string myipaddress, out string reason) |
108 | { | 108 | { |
109 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); | ||
110 | reason = String.Empty; | 109 | reason = String.Empty; |
111 | myipaddress = String.Empty; | 110 | myipaddress = String.Empty; |
112 | 111 | ||
113 | if (destination == null) | 112 | if (destination == null) |
114 | { | 113 | { |
115 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Given destination is null"); | 114 | reason = "Destination not found"; |
115 | m_log.Debug("[REMOTE SIMULATION CONNECTOR]: Create agent destination is null"); | ||
116 | return false; | 116 | return false; |
117 | } | 117 | } |
118 | 118 | ||
119 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: Creating agent at {0}", destination.ServerURI); | ||
120 | |||
119 | string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; | 121 | string uri = destination.ServerURI + AgentPath() + aCircuit.AgentID + "/"; |
120 | 122 | ||
121 | try | 123 | try |
122 | { | 124 | { |
123 | OSDMap args = aCircuit.PackAgentCircuitData(); | 125 | OSDMap args = aCircuit.PackAgentCircuitData(ctx); |
126 | args["context"] = ctx.Pack(); | ||
124 | PackData(args, source, aCircuit, destination, flags); | 127 | PackData(args, source, aCircuit, destination, flags); |
125 | 128 | ||
126 | OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); | 129 | OSDMap result = WebUtil.PostToServiceCompressed(uri, args, 30000); |
@@ -134,7 +137,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
134 | myipaddress = data["your_ip"].AsString(); | 137 | myipaddress = data["your_ip"].AsString(); |
135 | return success; | 138 | return success; |
136 | } | 139 | } |
137 | 140 | ||
138 | // Try the old version, uncompressed | 141 | // Try the old version, uncompressed |
139 | result = WebUtil.PostToService(uri, args, 30000, false); | 142 | result = WebUtil.PostToService(uri, args, 30000, false); |
140 | 143 | ||
@@ -152,10 +155,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
152 | return success; | 155 | return success; |
153 | } | 156 | } |
154 | } | 157 | } |
155 | 158 | ||
156 | m_log.WarnFormat( | 159 | m_log.WarnFormat( |
157 | "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}", | 160 | "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {2}", |
158 | aCircuit.firstname, aCircuit.lastname, destination.RegionName); | 161 | aCircuit.firstname, aCircuit.lastname, destination.RegionName); |
159 | reason = result["Message"] != null ? result["Message"].AsString() : "error"; | 162 | reason = result["Message"] != null ? result["Message"].AsString() : "error"; |
160 | return false; | 163 | return false; |
161 | } | 164 | } |
@@ -171,9 +174,9 @@ namespace OpenSim.Services.Connectors.Simulation | |||
171 | /// <summary> | 174 | /// <summary> |
172 | /// Send complete data about an agent in this region to a neighbor | 175 | /// Send complete data about an agent in this region to a neighbor |
173 | /// </summary> | 176 | /// </summary> |
174 | public bool UpdateAgent(GridRegion destination, AgentData data) | 177 | public bool UpdateAgent(GridRegion destination, AgentData data, EntityTransferContext ctx) |
175 | { | 178 | { |
176 | return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds | 179 | return UpdateAgent(destination, (IAgentData)data, ctx, 200000); // yes, 200 seconds |
177 | } | 180 | } |
178 | 181 | ||
179 | private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); | 182 | private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>(); |
@@ -199,8 +202,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
199 | { | 202 | { |
200 | if (m_updateAgentQueue.ContainsKey(uri)) | 203 | if (m_updateAgentQueue.ContainsKey(uri)) |
201 | { | 204 | { |
202 | // Another thread is already handling | 205 | // Another thread is already handling |
203 | // updates for this simulator, just update | 206 | // updates for this simulator, just update |
204 | // the position and return, overwrites are | 207 | // the position and return, overwrites are |
205 | // not a problem since we only care about the | 208 | // not a problem since we only care about the |
206 | // last update anyway | 209 | // last update anyway |
@@ -234,7 +237,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
234 | } | 237 | } |
235 | } | 238 | } |
236 | 239 | ||
237 | success = UpdateAgent(destination, (IAgentData)pos, 10000); | 240 | EntityTransferContext ctx = new EntityTransferContext(); // Dummy, not needed for position |
241 | success = UpdateAgent(destination, (IAgentData)pos, ctx, 10000); | ||
238 | } | 242 | } |
239 | // we get here iff success == false | 243 | // we get here iff success == false |
240 | // blacklist sim for 2 minutes | 244 | // blacklist sim for 2 minutes |
@@ -249,7 +253,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
249 | /// <summary> | 253 | /// <summary> |
250 | /// This is the worker function to send AgentData to a neighbor region | 254 | /// This is the worker function to send AgentData to a neighbor region |
251 | /// </summary> | 255 | /// </summary> |
252 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, int timeout) | 256 | private bool UpdateAgent(GridRegion destination, IAgentData cAgentData, EntityTransferContext ctx, int timeout) |
253 | { | 257 | { |
254 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI); | 258 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: UpdateAgent in {0}", destination.ServerURI); |
255 | 259 | ||
@@ -258,12 +262,13 @@ namespace OpenSim.Services.Connectors.Simulation | |||
258 | 262 | ||
259 | try | 263 | try |
260 | { | 264 | { |
261 | OSDMap args = cAgentData.Pack(); | 265 | OSDMap args = cAgentData.Pack(ctx); |
262 | 266 | ||
263 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); | 267 | args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); |
264 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); | 268 | args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); |
265 | args["destination_name"] = OSD.FromString(destination.RegionName); | 269 | args["destination_name"] = OSD.FromString(destination.RegionName); |
266 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); | 270 | args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); |
271 | args["context"] = ctx.Pack(); | ||
267 | 272 | ||
268 | OSDMap result = WebUtil.PutToServiceCompressed(uri, args, timeout); | 273 | OSDMap result = WebUtil.PutToServiceCompressed(uri, args, timeout); |
269 | if (result["Success"].AsBoolean()) | 274 | if (result["Success"].AsBoolean()) |
@@ -284,20 +289,19 @@ namespace OpenSim.Services.Connectors.Simulation | |||
284 | 289 | ||
285 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason) | 290 | public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List<UUID> featuresAvailable, EntityTransferContext ctx, out string reason) |
286 | { | 291 | { |
292 | Culture.SetCurrentCulture(); | ||
293 | |||
287 | reason = "Failed to contact destination"; | 294 | reason = "Failed to contact destination"; |
288 | 295 | ||
289 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); | 296 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); |
290 | 297 | ||
291 | IPEndPoint ext = destination.ExternalEndPoint; | ||
292 | if (ext == null) return false; | ||
293 | |||
294 | // Eventually, we want to use a caps url instead of the agentID | 298 | // Eventually, we want to use a caps url instead of the agentID |
295 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; | 299 | string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/"; |
296 | 300 | ||
297 | OSDMap request = new OSDMap(); | 301 | OSDMap request = new OSDMap(); |
298 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); | 302 | request.Add("viaTeleport", OSD.FromBoolean(viaTeleport)); |
299 | request.Add("position", OSD.FromString(position.ToString())); | 303 | request.Add("position", OSD.FromString(position.ToString())); |
300 | // To those who still understad this field, we're telling them | 304 | // To those who still understad this field, we're telling them |
301 | // the lowest version just to be safe | 305 | // the lowest version just to be safe |
302 | request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin))); | 306 | request.Add("my_version", OSD.FromString(String.Format("SIMULATION/{0}", VersionInfo.SimulationServiceVersionSupportedMin))); |
303 | // New simulation service negotiation | 307 | // New simulation service negotiation |
@@ -306,6 +310,8 @@ namespace OpenSim.Services.Connectors.Simulation | |||
306 | request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin)); | 310 | request.Add("simulation_service_accepted_min", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMin)); |
307 | request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax)); | 311 | request.Add("simulation_service_accepted_max", OSD.FromReal(VersionInfo.SimulationServiceVersionAcceptedMax)); |
308 | 312 | ||
313 | request.Add("context", ctx.Pack()); | ||
314 | |||
309 | OSDArray features = new OSDArray(); | 315 | OSDArray features = new OSDArray(); |
310 | foreach (UUID feature in featuresAvailable) | 316 | foreach (UUID feature in featuresAvailable) |
311 | features.Add(OSD.FromString(feature.ToString())); | 317 | features.Add(OSD.FromString(feature.ToString())); |
@@ -325,7 +331,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
325 | 331 | ||
326 | // FIXME: If there is a _Result map then it's the success key here that indicates the true success | 332 | // FIXME: If there is a _Result map then it's the success key here that indicates the true success |
327 | // or failure, not the sibling result node. | 333 | // or failure, not the sibling result node. |
328 | success = data["success"]; | 334 | success = data["success"].AsBoolean(); |
329 | 335 | ||
330 | reason = data["reason"].AsString(); | 336 | reason = data["reason"].AsString(); |
331 | // We will need to plumb this and start sing the outbound version as well | 337 | // We will need to plumb this and start sing the outbound version as well |
@@ -345,8 +351,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
345 | ctx.OutboundVersion = float.Parse(parts[1]); | 351 | ctx.OutboundVersion = float.Parse(parts[1]); |
346 | } | 352 | } |
347 | } | 353 | } |
348 | if (data.ContainsKey("variable_wearables_count_supported")) | ||
349 | ctx.VariableWearablesSupported = true; | ||
350 | 354 | ||
351 | m_log.DebugFormat( | 355 | m_log.DebugFormat( |
352 | "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}", | 356 | "[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}, reason {2}, version {3}/{4}", |
@@ -367,7 +371,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
367 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); | 371 | m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); |
368 | return true; | 372 | return true; |
369 | } | 373 | } |
370 | 374 | ||
371 | reason = result["Message"]; | 375 | reason = result["Message"]; |
372 | } | 376 | } |
373 | else | 377 | else |
@@ -379,7 +383,6 @@ namespace OpenSim.Services.Connectors.Simulation | |||
379 | return false; | 383 | return false; |
380 | } | 384 | } |
381 | 385 | ||
382 | |||
383 | featuresAvailable.Clear(); | 386 | featuresAvailable.Clear(); |
384 | 387 | ||
385 | if (result.ContainsKey("features")) | 388 | if (result.ContainsKey("features")) |
@@ -390,13 +393,21 @@ namespace OpenSim.Services.Connectors.Simulation | |||
390 | featuresAvailable.Add(new UUID(o.AsString())); | 393 | featuresAvailable.Add(new UUID(o.AsString())); |
391 | } | 394 | } |
392 | 395 | ||
396 | // Version stuff | ||
397 | if (ctx.OutboundVersion < 0.5) | ||
398 | ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES; | ||
399 | else if (ctx.OutboundVersion < 0.6) | ||
400 | ctx.WearablesCount = AvatarWearable.LEGACY_VERSION_MAX_WEARABLES + 1; | ||
401 | else | ||
402 | ctx.WearablesCount = -1; // send all (just in case..) | ||
403 | |||
393 | return success; | 404 | return success; |
394 | } | 405 | } |
395 | catch (Exception e) | 406 | catch (Exception e) |
396 | { | 407 | { |
397 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString()); | 408 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] QueryAcesss failed with exception; {0}",e.ToString()); |
398 | } | 409 | } |
399 | 410 | ||
400 | return false; | 411 | return false; |
401 | } | 412 | } |
402 | 413 | ||
@@ -414,7 +425,7 @@ namespace OpenSim.Services.Connectors.Simulation | |||
414 | { | 425 | { |
415 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString()); | 426 | m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] ReleaseAgent failed with exception; {0}",e.ToString()); |
416 | } | 427 | } |
417 | 428 | ||
418 | return true; | 429 | return true; |
419 | } | 430 | } |
420 | 431 | ||
diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index c21db54..68ae7bb 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs | |||
@@ -191,10 +191,107 @@ namespace OpenSim.Services.Connectors | |||
191 | return accounts; | 191 | return accounts; |
192 | } | 192 | } |
193 | 193 | ||
194 | public virtual List<UserAccount> GetUserAccounts(UUID scopeID, List<string> IDs) | ||
195 | { | ||
196 | List<UserAccount> accs = new List<UserAccount>(); | ||
197 | bool multisuported = true; | ||
198 | accs = doGetMultiUserAccounts(scopeID, IDs, out multisuported); | ||
199 | if(multisuported) | ||
200 | return accs; | ||
201 | |||
202 | // service does not do multi accounts so need to do it one by one | ||
203 | |||
204 | UUID uuid = UUID.Zero; | ||
205 | foreach(string id in IDs) | ||
206 | { | ||
207 | if(UUID.TryParse(id, out uuid) && uuid != UUID.Zero) | ||
208 | accs.Add(GetUserAccount(scopeID,uuid)); | ||
209 | } | ||
210 | |||
211 | return accs; | ||
212 | } | ||
213 | |||
214 | private List<UserAccount> doGetMultiUserAccounts(UUID scopeID, List<string> IDs, out bool suported) | ||
215 | { | ||
216 | suported = true; | ||
217 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | ||
218 | //sendData["SCOPEID"] = scopeID.ToString(); | ||
219 | sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); | ||
220 | sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); | ||
221 | sendData["METHOD"] = "getmultiaccounts"; | ||
222 | |||
223 | sendData["ScopeID"] = scopeID.ToString(); | ||
224 | sendData["IDS"] = new List<string>(IDs); | ||
225 | |||
226 | string reply = string.Empty; | ||
227 | string reqString = ServerUtils.BuildQueryString(sendData); | ||
228 | string uri = m_ServerURI + "/accounts"; | ||
229 | // m_log.DebugFormat("[ACCOUNTS CONNECTOR]: queryString = {0}", reqString); | ||
230 | try | ||
231 | { | ||
232 | reply = SynchronousRestFormsRequester.MakeRequest("POST", | ||
233 | uri, | ||
234 | reqString, | ||
235 | m_Auth); | ||
236 | if (reply == null || (reply != null && reply == string.Empty)) | ||
237 | { | ||
238 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received null or empty reply"); | ||
239 | return null; | ||
240 | } | ||
241 | } | ||
242 | catch (Exception e) | ||
243 | { | ||
244 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: Exception when contacting user accounts server at {0}: {1}", uri, e.Message); | ||
245 | } | ||
246 | |||
247 | List<UserAccount> accounts = new List<UserAccount>(); | ||
248 | |||
249 | Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply); | ||
250 | |||
251 | if (replyData != null) | ||
252 | { | ||
253 | if (replyData.ContainsKey("result")) | ||
254 | { | ||
255 | if(replyData["result"].ToString() == "null") | ||
256 | return accounts; | ||
257 | |||
258 | if(replyData["result"].ToString() == "Failure") | ||
259 | { | ||
260 | suported = false; | ||
261 | return accounts; | ||
262 | } | ||
263 | } | ||
264 | |||
265 | Dictionary<string, object>.ValueCollection accountList = replyData.Values; | ||
266 | //m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); | ||
267 | foreach (object acc in accountList) | ||
268 | { | ||
269 | if (acc is Dictionary<string, object>) | ||
270 | { | ||
271 | UserAccount pinfo = new UserAccount((Dictionary<string, object>)acc); | ||
272 | accounts.Add(pinfo); | ||
273 | } | ||
274 | else | ||
275 | m_log.DebugFormat("[ACCOUNT CONNECTOR]: GetMultiUserAccounts received invalid response type {0}", | ||
276 | acc.GetType()); | ||
277 | } | ||
278 | } | ||
279 | else | ||
280 | m_log.DebugFormat("[ACCOUNTS CONNECTOR]: GetMultiUserAccounts received null response"); | ||
281 | |||
282 | return accounts; | ||
283 | } | ||
284 | |||
285 | |||
194 | public void InvalidateCache(UUID userID) | 286 | public void InvalidateCache(UUID userID) |
195 | { | 287 | { |
196 | } | 288 | } |
197 | 289 | ||
290 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string where) | ||
291 | { | ||
292 | return null; // Not implemented for regions | ||
293 | } | ||
294 | |||
198 | public virtual bool StoreUserAccount(UserAccount data) | 295 | public virtual bool StoreUserAccount(UserAccount data) |
199 | { | 296 | { |
200 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 297 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
@@ -247,7 +344,7 @@ namespace OpenSim.Services.Connectors | |||
247 | 344 | ||
248 | return SendAndGetReply(sendData); | 345 | return SendAndGetReply(sendData); |
249 | } | 346 | } |
250 | 347 | ||
251 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) | 348 | private UserAccount SendAndGetReply(Dictionary<string, object> sendData) |
252 | { | 349 | { |
253 | string reply = string.Empty; | 350 | string reply = string.Empty; |