From 27cdfb7b840423cf8cee08988dc487eeb34d71c7 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 08:47:45 -0700 Subject: HG Friends: debug an issue where the friends data stored in the DB is incomplete. --- OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | 1 + OpenSim/Services/Friends/FriendsService.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index ae45b99..d8f7dc9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -546,6 +546,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID.ToString(), theFriendUUID, 1); // and also the converse FriendsService.StoreFriend(theFriendUUID, agentID.ToString(), 1); + m_log.DebugFormat("[HGFRIENDS MODULE]: Stored {0} {01}", agentID, theFriendUUID); //if (!confirming) //{ diff --git a/OpenSim/Services/Friends/FriendsService.cs b/OpenSim/Services/Friends/FriendsService.cs index e2033ac..dd3f733 100644 --- a/OpenSim/Services/Friends/FriendsService.cs +++ b/OpenSim/Services/Friends/FriendsService.cs @@ -29,6 +29,7 @@ using OpenMetaverse; using OpenSim.Framework; using System; using System.Collections.Generic; +using System.Reflection; using OpenSim.Services.Interfaces; using OpenSim.Data; using Nini.Config; @@ -39,7 +40,12 @@ namespace OpenSim.Services.Friends { public class FriendsService : FriendsServiceBase, IFriendsService { - public FriendsService(IConfigSource config) : base(config) + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public FriendsService(IConfigSource config) + : base(config) { } @@ -98,6 +104,7 @@ namespace OpenSim.Services.Friends d.Data = new Dictionary(); d.Data["Flags"] = flags.ToString(); + m_log.DebugFormat("[FRIENDS]: Storing {0} {1}", PrincipalID, Friend); return m_Database.Store(d); } -- cgit v1.1 From 5eb78aad96f2dbaf7c4c0e5fa7e678076a2edbfc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 09:17:01 -0700 Subject: Revert "HG Friends: debug an issue where the friends data stored in the DB is incomplete." This reverts commit 27cdfb7b840423cf8cee08988dc487eeb34d71c7. --- OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs | 1 - OpenSim/Services/Friends/FriendsService.cs | 9 +-------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index d8f7dc9..ae45b99 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -546,7 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends FriendsService.StoreFriend(agentID.ToString(), theFriendUUID, 1); // and also the converse FriendsService.StoreFriend(theFriendUUID, agentID.ToString(), 1); - m_log.DebugFormat("[HGFRIENDS MODULE]: Stored {0} {01}", agentID, theFriendUUID); //if (!confirming) //{ diff --git a/OpenSim/Services/Friends/FriendsService.cs b/OpenSim/Services/Friends/FriendsService.cs index dd3f733..e2033ac 100644 --- a/OpenSim/Services/Friends/FriendsService.cs +++ b/OpenSim/Services/Friends/FriendsService.cs @@ -29,7 +29,6 @@ using OpenMetaverse; using OpenSim.Framework; using System; using System.Collections.Generic; -using System.Reflection; using OpenSim.Services.Interfaces; using OpenSim.Data; using Nini.Config; @@ -40,12 +39,7 @@ namespace OpenSim.Services.Friends { public class FriendsService : FriendsServiceBase, IFriendsService { - private static readonly ILog m_log = - LogManager.GetLogger( - MethodBase.GetCurrentMethod().DeclaringType); - - public FriendsService(IConfigSource config) - : base(config) + public FriendsService(IConfigSource config) : base(config) { } @@ -104,7 +98,6 @@ namespace OpenSim.Services.Friends d.Data = new Dictionary(); d.Data["Flags"] = flags.ToString(); - m_log.DebugFormat("[FRIENDS]: Storing {0} {1}", PrincipalID, Friend); return m_Database.Store(d); } -- cgit v1.1 From 068a3afad9b585399e5422108f8c5074c9e6b33f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 09:51:31 -0700 Subject: HG Friends: migration #3 is failing on some installations of MySql. Setting the table to InnoDB seems to fix the problem. --- OpenSim/Data/MySQL/Resources/FriendsStore.migrations | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 55d82ec..5faf956 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations @@ -9,7 +9,7 @@ CREATE TABLE `Friends` ( `Offered` VARCHAR(32) NOT NULL DEFAULT 0, PRIMARY KEY(`PrincipalID`, `Friend`), KEY(`PrincipalID`) -); +) ENGINE=InnoDB; COMMIT; -- cgit v1.1 From 98a2fa8e358a6a008eea28161e48e4bfc877e11e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 10:23:20 -0700 Subject: HG Friends: this was commented some commits ago, but it shouldn't have been. --- .../CoreModules/Avatar/Friends/HGFriendsModule.cs | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index ae45b99..6d1fd1f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -348,31 +348,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return null; } -// public override FriendInfo[] GetFriendsFromService(IClientAPI client) -// { -//// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); -// Boolean agentIsLocal = true; -// if (UserManagementModule != null) -// agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); - -// if (agentIsLocal) -// return base.GetFriendsFromService(client); - -// FriendInfo[] finfos = new FriendInfo[0]; -// // Foreigner -// AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); -// if (agentClientCircuit != null) -// { -// //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); - -// finfos = FriendsService.GetFriends(client.AgentId.ToString()); -// m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); -// } - -//// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); - -// return finfos; -// } + public override FriendInfo[] GetFriendsFromService(IClientAPI client) + { + // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); + Boolean agentIsLocal = true; + if (UserManagementModule != null) + agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); + + if (agentIsLocal) + return base.GetFriendsFromService(client); + + FriendInfo[] finfos = new FriendInfo[0]; + // Foreigner + AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); + if (agentClientCircuit != null) + { + // Note that this is calling a different interface than base; this one calls with a string param! + finfos = FriendsService.GetFriends(client.AgentId.ToString()); + m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); + } + + // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); + + return finfos; + } protected override bool StoreRights(UUID agentID, UUID friendID, int rights) { -- cgit v1.1 From ae42c93f9a2c7df4e7c14896df27544f283c8114 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 10:59:21 -0700 Subject: Now trying to find a cause of freeze at login related to friends status notifications. --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 41ea2a2..bc501b7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -526,8 +526,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendSession.RegionID != UUID.Zero) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); + if (region != null) + { + m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); + m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); + } } } } -- cgit v1.1 From 0cc0a2485c6502df096b9070ff0c8e5584dae2fd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 4 Jul 2013 11:18:05 -0700 Subject: More debug related to the previous commit --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index bc501b7..16a2b9b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -526,9 +526,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendSession.RegionID != UUID.Zero) { GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); + m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", (region == null ? "null" : region.RegionName)); if (region != null) { - m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); } } -- cgit v1.1