diff options
Merge branch 'master' into careminster-presence-refactor
The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
Diffstat (limited to '')
8 files changed, 66 insertions, 74 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs index a871d07..67a06f3 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs | |||
@@ -26,11 +26,9 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | 29 | using System.Reflection; |
31 | using OpenSim.Framework; | 30 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 31 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Services.Interfaces; | ||
34 | using OpenMetaverse; | 32 | using OpenMetaverse; |
35 | using log4net; | 33 | using log4net; |
36 | 34 | ||
@@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
71 | public void OnMakeRootAgent(ScenePresence sp) | 69 | public void OnMakeRootAgent(ScenePresence sp) |
72 | { | 70 | { |
73 | m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); | 71 | m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); |
74 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 72 | Util.FireAndForget(delegate(object o) |
73 | { | ||
74 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | ||
75 | }); | ||
75 | } | 76 | } |
76 | 77 | ||
77 | public void OnNewClient(IClientAPI client) | 78 | public void OnNewClient(IClientAPI client) |
@@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
107 | 108 | ||
108 | void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) | 109 | void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) |
109 | { | 110 | { |
110 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | 111 | // Asynchronously update the position stored in the session table for this agent |
112 | Util.FireAndForget(delegate(object o) | ||
113 | { | ||
114 | m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); | ||
115 | }); | ||
111 | } | 116 | } |
112 | } | 117 | } |
113 | } | 118 | } |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 6d5b30e..30d3147 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
84 | CommonInit(source); | 84 | CommonInit(source); |
85 | } | 85 | } |
86 | 86 | ||
87 | public SimianAssetServiceConnector(string url) | ||
88 | { | ||
89 | m_serverUrl = url; | ||
90 | } | ||
91 | |||
87 | public void Initialise(IConfigSource source) | 92 | public void Initialise(IConfigSource source) |
88 | { | 93 | { |
89 | IConfig moduleConfig = source.Configs["Modules"]; | 94 | IConfig moduleConfig = source.Configs["Modules"]; |
@@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
119 | 124 | ||
120 | public AssetBase Get(string id) | 125 | public AssetBase Get(string id) |
121 | { | 126 | { |
127 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
128 | { | ||
129 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
130 | throw new InvalidOperationException(); | ||
131 | } | ||
132 | |||
122 | // Cache fetch | 133 | // Cache fetch |
123 | if (m_cache != null) | 134 | if (m_cache != null) |
124 | { | 135 | { |
@@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
145 | /// <returns></returns> | 156 | /// <returns></returns> |
146 | public AssetMetadata GetMetadata(string id) | 157 | public AssetMetadata GetMetadata(string id) |
147 | { | 158 | { |
159 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
160 | { | ||
161 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
162 | throw new InvalidOperationException(); | ||
163 | } | ||
164 | |||
148 | AssetMetadata metadata = null; | 165 | AssetMetadata metadata = null; |
149 | 166 | ||
150 | // Cache fetch | 167 | // Cache fetch |
@@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
216 | /// <returns>True if the id was parseable, false otherwise</returns> | 233 | /// <returns>True if the id was parseable, false otherwise</returns> |
217 | public bool Get(string id, Object sender, AssetRetrieved handler) | 234 | public bool Get(string id, Object sender, AssetRetrieved handler) |
218 | { | 235 | { |
236 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
237 | { | ||
238 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
239 | throw new InvalidOperationException(); | ||
240 | } | ||
241 | |||
219 | // Cache fetch | 242 | // Cache fetch |
220 | if (m_cache != null) | 243 | if (m_cache != null) |
221 | { | 244 | { |
@@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
246 | /// <returns></returns> | 269 | /// <returns></returns> |
247 | public string Store(AssetBase asset) | 270 | public string Store(AssetBase asset) |
248 | { | 271 | { |
272 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
273 | { | ||
274 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
275 | throw new InvalidOperationException(); | ||
276 | } | ||
277 | |||
249 | bool storedInCache = false; | 278 | bool storedInCache = false; |
250 | string errorMessage = null; | 279 | string errorMessage = null; |
251 | 280 | ||
@@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
378 | /// <returns></returns> | 407 | /// <returns></returns> |
379 | public bool Delete(string id) | 408 | public bool Delete(string id) |
380 | { | 409 | { |
410 | if (String.IsNullOrEmpty(m_serverUrl)) | ||
411 | { | ||
412 | m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured"); | ||
413 | throw new InvalidOperationException(); | ||
414 | } | ||
415 | |||
381 | //string errorMessage = String.Empty; | 416 | //string errorMessage = String.Empty; |
382 | string url = m_serverUrl + id; | 417 | string url = m_serverUrl + id; |
383 | 418 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 3505c64..4d0d53e 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs | |||
@@ -28,8 +28,6 @@ | |||
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.IO; | ||
32 | using System.Net; | ||
33 | using System.Reflection; | 31 | using System.Reflection; |
34 | using log4net; | 32 | using log4net; |
35 | using Mono.Addins; | 33 | using Mono.Addins; |
@@ -37,7 +35,6 @@ using Nini.Config; | |||
37 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Server.Base; | ||
41 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
42 | using OpenMetaverse; | 39 | using OpenMetaverse; |
43 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 5b18aef..6f2d735 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs | |||
@@ -30,13 +30,10 @@ using System.Collections.Generic; | |||
30 | using System.Collections.Specialized; | 30 | using System.Collections.Specialized; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using Mono.Addins; | ||
34 | using Nini.Config; | 33 | using Nini.Config; |
35 | using OpenMetaverse; | 34 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | 35 | using OpenMetaverse.StructuredData; |
37 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | ||
39 | using OpenSim.Region.Framework.Scenes; | ||
40 | using OpenSim.Services.Interfaces; | 37 | using OpenSim.Services.Interfaces; |
41 | 38 | ||
42 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; | 39 | using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 470eccd..21ad4ab 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Server.Base; | ||
41 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
42 | 41 | ||
43 | namespace OpenSim.Services.Connectors.SimianGrid | 42 | namespace OpenSim.Services.Connectors.SimianGrid |
@@ -91,6 +90,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
91 | CommonInit(source); | 90 | CommonInit(source); |
92 | } | 91 | } |
93 | 92 | ||
93 | public SimianInventoryServiceConnector(string url) | ||
94 | { | ||
95 | m_serverUrl = url; | ||
96 | } | ||
97 | |||
94 | public void Initialise(IConfigSource source) | 98 | public void Initialise(IConfigSource source) |
95 | { | 99 | { |
96 | IConfig moduleConfig = source.Configs["Modules"]; | 100 | IConfig moduleConfig = source.Configs["Modules"]; |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 077be3c..a344594 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs | |||
@@ -28,17 +28,14 @@ | |||
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.Net; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using log4net; | 32 | using log4net; |
34 | using Mono.Addins; | 33 | using Mono.Addins; |
35 | using Nini.Config; | 34 | using Nini.Config; |
36 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Server.Base; | ||
42 | using OpenMetaverse; | 39 | using OpenMetaverse; |
43 | using OpenMetaverse.StructuredData; | 40 | using OpenMetaverse.StructuredData; |
44 | 41 | ||
@@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
358 | return null; | 355 | return null; |
359 | } | 356 | } |
360 | 357 | ||
361 | // private OSDMap GetSessionData(UUID sessionID) | ||
362 | // { | ||
363 | // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); | ||
364 | // | ||
365 | // NameValueCollection requestArgs = new NameValueCollection | ||
366 | // { | ||
367 | // { "RequestMethod", "GetSession" }, | ||
368 | // { "SessionID", sessionID.ToString() } | ||
369 | // }; | ||
370 | // | ||
371 | // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
372 | // if (response["Success"].AsBoolean()) | ||
373 | // return response; | ||
374 | // else | ||
375 | // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); | ||
376 | // | ||
377 | // return null; | ||
378 | // } | ||
379 | |||
380 | private List<PresenceInfo> GetSessions(UUID userID) | 358 | private List<PresenceInfo> GetSessions(UUID userID) |
381 | { | 359 | { |
382 | List<PresenceInfo> presences = new List<PresenceInfo>(1); | 360 | List<PresenceInfo> presences = new List<PresenceInfo>(1); |
@@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
429 | return success; | 407 | return success; |
430 | } | 408 | } |
431 | 409 | ||
432 | ///// <summary> | ||
433 | ///// Fetch the last known avatar location with GetSession and persist it | ||
434 | ///// as user data with AddUserData | ||
435 | ///// </summary> | ||
436 | //private bool SetLastLocation(UUID sessionID) | ||
437 | //{ | ||
438 | // NameValueCollection requestArgs = new NameValueCollection | ||
439 | // { | ||
440 | // { "RequestMethod", "GetSession" }, | ||
441 | // { "SessionID", sessionID.ToString() } | ||
442 | // }; | ||
443 | |||
444 | // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); | ||
445 | // bool success = response["Success"].AsBoolean(); | ||
446 | |||
447 | // if (success) | ||
448 | // { | ||
449 | // UUID userID = response["UserID"].AsUUID(); | ||
450 | // UUID sceneID = response["SceneID"].AsUUID(); | ||
451 | // Vector3 position = response["ScenePosition"].AsVector3(); | ||
452 | // Vector3 lookAt = response["SceneLookAt"].AsVector3(); | ||
453 | |||
454 | // return SetLastLocation(userID, sceneID, position, lookAt); | ||
455 | // } | ||
456 | // else | ||
457 | // { | ||
458 | // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID + | ||
459 | // " while saving last location: " + response["Message"].AsString()); | ||
460 | // } | ||
461 | |||
462 | // return success; | ||
463 | //} | ||
464 | |||
465 | private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) | 410 | private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) |
466 | { | 411 | { |
467 | if (sessionResponse == null) | 412 | if (sessionResponse == null) |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 0ef4974..b7e8538 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs | |||
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
291 | // Check if the user is online | 291 | // Check if the user is online |
292 | if (client.Scene is Scene) | 292 | if (client.Scene is Scene) |
293 | { | 293 | { |
294 | OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); | 294 | OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID); |
295 | if (presences != null && presences.Length > 0) | 295 | if (presence != null) |
296 | flags |= ProfileFlags.Online; | 296 | flags |= ProfileFlags.Online; |
297 | } | 297 | } |
298 | 298 | ||
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 694aa72..ddd2322 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | |||
@@ -28,7 +28,6 @@ | |||
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.IO; | ||
32 | using System.Reflection; | 31 | using System.Reflection; |
33 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
34 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
@@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 48 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
50 | public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule | 49 | public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule |
51 | { | 50 | { |
51 | private const double CACHE_EXPIRATION_SECONDS = 120.0; | ||
52 | |||
52 | private static readonly ILog m_log = | 53 | private static readonly ILog m_log = |
53 | LogManager.GetLogger( | 54 | LogManager.GetLogger( |
54 | MethodBase.GetCurrentMethod().DeclaringType); | 55 | MethodBase.GetCurrentMethod().DeclaringType); |
55 | 56 | ||
56 | private string m_serverUrl = String.Empty; | 57 | private string m_serverUrl = String.Empty; |
57 | private ExpiringCache<UUID, UserAccount> m_accountCache; | 58 | private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>(); |
58 | private bool m_Enabled = false; | 59 | private bool m_Enabled; |
59 | 60 | ||
60 | #region ISharedRegionModule | 61 | #region ISharedRegionModule |
61 | 62 | ||
@@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
141 | { "UserID", userID.ToString() } | 142 | { "UserID", userID.ToString() } |
142 | }; | 143 | }; |
143 | 144 | ||
144 | return GetUser(requestArgs); | 145 | account = GetUser(requestArgs); |
146 | |||
147 | if (account == null) | ||
148 | { | ||
149 | // Store null responses too, to avoid repeated lookups for missing accounts | ||
150 | m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); | ||
151 | } | ||
152 | |||
153 | return account; | ||
145 | } | 154 | } |
146 | 155 | ||
147 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 156 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
@@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
216 | if (success) | 225 | if (success) |
217 | { | 226 | { |
218 | // Cache the user account info | 227 | // Cache the user account info |
219 | m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 228 | m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); |
220 | } | 229 | } |
221 | else | 230 | else |
222 | { | 231 | { |
@@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
281 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); | 290 | GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); |
282 | 291 | ||
283 | // Cache the user account info | 292 | // Cache the user account info |
284 | m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); | 293 | m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS)); |
285 | 294 | ||
286 | return account; | 295 | return account; |
287 | } | 296 | } |