From cdf97ab3a654581fe5c3f29b1b3a6459c8c73378 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 7 May 2012 17:21:45 +0100 Subject: Fix a bug in FriendsModule.StatusNotify() where all subsequent friends would not be notified once a non-local friend was found. --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index fc6325d..98afbc9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -498,7 +498,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends Util.FireAndForget( delegate { - m_log.DebugFormat("[FRIENDS MODULE]: Notifying {0} friends", friendList.Count); + m_log.DebugFormat( + "[FRIENDS MODULE]: Notifying {0} friends of {1} of online status {2}", + friendList.Count, agentID, online); + // Notify about this user status StatusNotify(friendList, agentID, online); } @@ -515,7 +518,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { // Try local if (LocalStatusNotification(userID, friendID, online)) - return; + continue; // The friend is not here [as root]. Let's forward. PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); @@ -523,11 +526,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { PresenceInfo friendSession = null; foreach (PresenceInfo pinfo in friendSessions) + { if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad { friendSession = pinfo; break; } + } if (friendSession != null) { -- cgit v1.1 From 5053506d88ac8b06be27ffb404bcc120e3f48241 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 7 May 2012 18:27:33 +0100 Subject: refactor: Instead of performing a ScenePresence lookup twice over LocateClientObject() and GetClientScene(), do the lookup just once in LocateClientObject() --- .../CoreModules/Avatar/Friends/FriendsModule.cs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 98afbc9..24ec435 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -449,29 +449,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends /// public IClientAPI LocateClientObject(UUID agentID) { - Scene scene = GetClientScene(agentID); - if (scene != null) - { - ScenePresence presence = scene.GetScenePresence(agentID); - if (presence != null) - return presence.ControllingClient; - } - - return null; - } - - /// - /// Find the scene for an agent - /// - private Scene GetClientScene(UUID agentId) - { lock (m_Scenes) { foreach (Scene scene in m_Scenes) { - ScenePresence presence = scene.GetScenePresence(agentId); + ScenePresence presence = scene.GetScenePresence(agentID); if (presence != null && !presence.IsChildAgent) - return scene; + return presence.ControllingClient; } } -- cgit v1.1 From a82dc263abe5ef2a7221609da14f75d7026f9fbe Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 7 May 2012 19:05:21 +0100 Subject: For osGetGridNick(), osGetGridName(), osGetGridLoginURI() and osGetGridCustom(), try to read from the [GridInfoService] section on standalone rather than [GridInfo] [GridInfoService] is the section that's actually in bin/config-include/StandaloneCommon.ini.example --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ed9a4e0..3b67966 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -128,6 +128,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + public const string GridInfoServiceConfigSectionName = "GridInfoService"; + internal IScriptEngine m_ScriptEngine; internal ILSL_Api m_LSL_Api = null; // get a reference to the LSL API so we can call methods housed there internal SceneObjectPart m_host; @@ -2032,8 +2034,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string nick = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - nick = config.Configs["GridInfo"].GetString("gridnick", nick); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); if (String.IsNullOrEmpty(nick)) nick = GridUserInfo(InfoType.Nick); @@ -2049,8 +2051,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string name = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - name = config.Configs["GridInfo"].GetString("gridname", name); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); if (String.IsNullOrEmpty(name)) name = GridUserInfo(InfoType.Name); @@ -2066,8 +2068,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string loginURI = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - loginURI = config.Configs["GridInfo"].GetString("login", loginURI); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); if (String.IsNullOrEmpty(loginURI)) loginURI = GridUserInfo(InfoType.Login); @@ -2114,8 +2116,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api string retval = String.Empty; IConfigSource config = m_ScriptEngine.ConfigSource; - if (config.Configs["GridInfo"] != null) - retval = config.Configs["GridInfo"].GetString(key, retval); + if (config.Configs[GridInfoServiceConfigSectionName] != null) + retval = config.Configs[GridInfoServiceConfigSectionName].GetString(key, retval); if (String.IsNullOrEmpty(retval)) retval = GridUserInfo(InfoType.Custom, key); -- cgit v1.1 From 65c88b2ff4e2616fa5c1d4c5e75298ed1eb1c0d8 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Sun, 29 Apr 2012 08:53:33 +0300 Subject: Better error handling if Load OAR or Save OAR fail --- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 20 ++++++++++++++++---- .../World/Archiver/ArchiveWriteRequestExecution.cs | 7 ++++++- .../World/Archiver/ArchiveWriteRequestPreparation.cs | 11 ++++++++++- 3 files changed, 32 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index a6dbaba..e360f93 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -200,8 +200,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } catch (Exception e) { - m_log.ErrorFormat( - "[ARCHIVER]: Aborting load with error in archive file {0}. {1}", filePath, e); + m_log.Error( + String.Format("[ARCHIVER]: Aborting load with error in archive file {0} ", filePath), e); m_errorMessage += e.ToString(); m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); return; @@ -219,6 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); + // Continue, because we allow the OAR to be loaded even if some assets fail } } @@ -228,8 +229,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene.DeleteAllSceneObjects(); } - LoadParcels(serialisedParcels); - LoadObjects(serialisedSceneObjects); + try + { + LoadParcels(serialisedParcels); + LoadObjects(serialisedSceneObjects); + } + catch (Exception e) + { + m_log.Error("[ARCHIVER]: Error loading parcels or objects ", e); + m_errorMessage += e.ToString(); + m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); + return; + } + m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index c179a34..2b40a9e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -87,6 +87,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Save(assetsFoundUuids, assetsNotFoundUuids); } + catch (Exception e) + { + m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString()); + throw; + } finally { m_archiveWriter.Close(); @@ -150,4 +155,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index eabe46e..384d81b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -124,6 +124,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (options.ContainsKey("noassets") && (bool)options["noassets"]) SaveAssets = false; + // Whether someone else (i.e., ReceivedAllAssets()) is responsible for calling TriggerOarFileSaved() when we're done + bool eventHandled = false; + try { Dictionary assetUuids = new Dictionary(); @@ -230,15 +233,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets); Util.FireAndForget(o => ar.Execute()); + eventHandled = true; } else { awre.ReceivedAllAssets(new List(), new List()); + eventHandled = true; } } - catch (Exception) + catch (Exception e) { m_saveStream.Close(); + + if (!eventHandled) + m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString()); + throw; } } -- cgit v1.1 From 5d1d47e1f9327c29ba26d231c8d18680d06cb1d9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 7 May 2012 20:01:17 +0100 Subject: Revert "Better error handling if Load OAR or Save OAR fail" This reverts commit 65c88b2ff4e2616fa5c1d4c5e75298ed1eb1c0d8. Yet again I accidentally committed something whilst evaluating it. --- .../CoreModules/World/Archiver/ArchiveReadRequest.cs | 20 ++++---------------- .../World/Archiver/ArchiveWriteRequestExecution.cs | 7 +------ .../World/Archiver/ArchiveWriteRequestPreparation.cs | 11 +---------- 3 files changed, 6 insertions(+), 32 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index e360f93..a6dbaba 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -200,8 +200,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } catch (Exception e) { - m_log.Error( - String.Format("[ARCHIVER]: Aborting load with error in archive file {0} ", filePath), e); + m_log.ErrorFormat( + "[ARCHIVER]: Aborting load with error in archive file {0}. {1}", filePath, e); m_errorMessage += e.ToString(); m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); return; @@ -219,7 +219,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver { m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); - // Continue, because we allow the OAR to be loaded even if some assets fail } } @@ -229,19 +228,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene.DeleteAllSceneObjects(); } - try - { - LoadParcels(serialisedParcels); - LoadObjects(serialisedSceneObjects); - } - catch (Exception e) - { - m_log.Error("[ARCHIVER]: Error loading parcels or objects ", e); - m_errorMessage += e.ToString(); - m_scene.EventManager.TriggerOarFileLoaded(m_requestId, m_errorMessage); - return; - } - + LoadParcels(serialisedParcels); + LoadObjects(serialisedSceneObjects); m_log.InfoFormat("[ARCHIVER]: Successfully loaded archive"); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs index 2b40a9e..c179a34 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs @@ -87,11 +87,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver { Save(assetsFoundUuids, assetsNotFoundUuids); } - catch (Exception e) - { - m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString()); - throw; - } finally { m_archiveWriter.Close(); @@ -155,4 +150,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver } } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index 384d81b..eabe46e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -124,9 +124,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver if (options.ContainsKey("noassets") && (bool)options["noassets"]) SaveAssets = false; - // Whether someone else (i.e., ReceivedAllAssets()) is responsible for calling TriggerOarFileSaved() when we're done - bool eventHandled = false; - try { Dictionary assetUuids = new Dictionary(); @@ -233,21 +230,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_scene.RegionInfo.ScopeID, options, awre.ReceivedAllAssets); Util.FireAndForget(o => ar.Execute()); - eventHandled = true; } else { awre.ReceivedAllAssets(new List(), new List()); - eventHandled = true; } } - catch (Exception e) + catch (Exception) { m_saveStream.Close(); - - if (!eventHandled) - m_scene.EventManager.TriggerOarFileSaved(m_requestId, e.ToString()); - throw; } } -- cgit v1.1