From 4b9e446c6267a1161263d885699e72c97e8a94eb Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 1 Jun 2011 16:57:01 -0400 Subject: [PATCH 01/13] Use current TravelingAgent if the login failure reason is "Logins Disabled" to fix NullReferenceException, allowing agent to login to fallback region when logins are disabled by "StartDisabled = true" or when logins are disabled by RegionReady --- OpenSim/Services/HypergridService/UserAgentService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 387547e252..2f2ebfba5a 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -197,8 +197,11 @@ namespace OpenSim.Services.HypergridService agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info - lock (m_TravelingAgents) - m_TravelingAgents[agentCircuit.SessionID] = old; + if(reason != "Logins Disabled") + { + lock (m_TravelingAgents) + m_TravelingAgents[agentCircuit.SessionID] = old; + } return false; } From 0a430bbffb561a5172220e7617257798c11a66f5 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 1 Jun 2011 18:10:56 -0400 Subject: [PATCH 02/13] Revert "Use current TravelingAgent if the login failure reason is "Logins Disabled" to fix NullReferenceException, allowing agent to login to fallback region when logins are disabled by "StartDisabled = true" or when logins are disabled by RegionReady" This reverts commit 4b9e446c6267a1161263d885699e72c97e8a94eb. --- OpenSim/Services/HypergridService/UserAgentService.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 2f2ebfba5a..387547e252 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -197,11 +197,8 @@ namespace OpenSim.Services.HypergridService agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info - if(reason != "Logins Disabled") - { - lock (m_TravelingAgents) - m_TravelingAgents[agentCircuit.SessionID] = old; - } + lock (m_TravelingAgents) + m_TravelingAgents[agentCircuit.SessionID] = old; return false; } From 777f57d9469d4df11ea2bf2bd0704f89cae34b0a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 1 Jun 2011 18:47:06 -0400 Subject: [PATCH 03/13] Re-Apply Use current TravelingAgent if the the login failure reason is "Logins Disabled" to fix NullReferenceException, allowing agent to login to fallback region when logins are disabled by "StartDisabled = true" or when logins are disabled by RegionReady"" This reverts commit 0a430bbffb561a5172220e7617257798c11a66f5. --- OpenSim/Services/HypergridService/UserAgentService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 387547e252..2f2ebfba5a 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -197,8 +197,11 @@ namespace OpenSim.Services.HypergridService agentCircuit.firstname, agentCircuit.lastname, region.ServerURI, reason); // restore the old travel info - lock (m_TravelingAgents) - m_TravelingAgents[agentCircuit.SessionID] = old; + if(reason != "Logins Disabled") + { + lock (m_TravelingAgents) + m_TravelingAgents[agentCircuit.SessionID] = old; + } return false; } From 46cdd442a8daebe5b1573f09cd5cef51c0b17874 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 1 Jun 2011 18:18:31 -0700 Subject: [PATCH 04/13] [Profiles] --> [Profile] --- .../Region/CoreModules/Avatar/Profile/BasicProfileModule.cs | 4 ++-- bin/config-include/Grid.ini | 2 +- bin/config-include/GridHypergrid.ini | 2 +- bin/config-include/Standalone.ini | 2 +- bin/config-include/StandaloneHypergrid.ini | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs index e04fff6c78..079e1b6b0a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profile/BasicProfileModule.cs @@ -57,9 +57,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Profile public void Initialise(IConfigSource config) { - if (config.Configs["Profiles"] != null) + if (config.Configs["Profile"] != null) { - if (config.Configs["Profiles"].GetString("Module", string.Empty) != "BasicProfileModule") + if (config.Configs["Profile"].GetString("Module", string.Empty) != "BasicProfileModule") return; } diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index baadbb86ff..52205732f0 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -27,7 +27,7 @@ SimulationServiceInConnector = true LibraryModule = true -[Profiles] +[Profile] Module = "BasicProfileModule" [SimulationDataStore] diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index 510a315647..b8e66c2733 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -31,7 +31,7 @@ SimulationServiceInConnector = true LibraryModule = true -[Profiles] +[Profile] Module = "BasicProfileModule" [SimulationDataStore] diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index cfcf5ed8c7..4ff1a269bf 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -22,7 +22,7 @@ LLLoginServiceInConnector = true GridInfoServiceInConnector = true -[Profiles] +[Profile] Module = "BasicProfileModule" [SimulationDataStore] diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index 44ca3acaca..574375eed8 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -32,7 +32,7 @@ AuthenticationServiceInConnector = true SimulationServiceInConnector = true -[Profiles] +[Profile] Module = "BasicProfileModule" [Messaging] From 3fa54a156a83e498a7d5d0949a5f848fe82fe86f Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 1 Jun 2011 20:02:26 -0700 Subject: [PATCH 05/13] Changed Friends table to have 165-sized varchars on PrincipalID and FriendID. The reason for this number is the following: there is a combined key of these 2 fields; apparently MySql can't handle keys larger than 1000 bytes; when the table is created with utf8 encoding, this combined key is bigger than 1000 bytes, and the migration fails. WARNING: this is not a new migration! People who have gone through this migration and failed should update the sizes of these fields manually. --- OpenSim/Data/MySQL/Resources/FriendsStore.migrations | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 35e5e93cde..5abacf5c87 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations @@ -25,7 +25,8 @@ COMMIT; BEGIN; -ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; +ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(165) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; +ALTER TABLE `Friends` MODIFY COLUMN Friend varchar(165) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; COMMIT; From 43ecc46a224d07661af42379f12f394e1bd873fd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 1 Jun 2011 20:09:59 -0700 Subject: [PATCH 06/13] It looks like there's a better solution for that problem. Revert "Changed Friends table to have 165-sized varchars on PrincipalID and FriendID. The reason for this number is the following: there is a combined key of these 2 fields; apparently MySql can't handle keys larger than 1000 bytes; when the table is created with utf8 encoding, this combined key is bigger than 1000 bytes, and the migration fails. WARNING: this is not a new migration! People who have gone through this migration and failed should update the sizes of these fields manually." This reverts commit 3fa54a156a83e498a7d5d0949a5f848fe82fe86f. --- OpenSim/Data/MySQL/Resources/FriendsStore.migrations | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 5abacf5c87..35e5e93cde 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations @@ -25,8 +25,7 @@ COMMIT; BEGIN; -ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(165) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; -ALTER TABLE `Friends` MODIFY COLUMN Friend varchar(165) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; +ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; COMMIT; From c13acdf5a1a94df9b0ef50b7b2739a9256656582 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 1 Jun 2011 20:19:22 -0700 Subject: [PATCH 07/13] This is the better solution: make the combined key be only on the first 36 characters of each field -- that's the UUIDs. Thanks coyled. WARNING: Again, people who have gone through this migration and failed need to run it manually. --- OpenSim/Data/MySQL/Resources/FriendsStore.migrations | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 35e5e93cde..7848e49955 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations @@ -25,7 +25,8 @@ COMMIT; BEGIN; +ALTER TABLE `Friends` DROP PRIMARY KEY; +ALTER TABLE `Friends` ADD PRIMARY KEY(PrincipalID(36), Friend(36)); ALTER TABLE `Friends` MODIFY COLUMN PrincipalID varchar(255) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; COMMIT; - From f2f30a78908c93e1397be52e476da9fb5c44282d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 07:26:40 -0700 Subject: [PATCH 08/13] HG Friends bug fix: connector was shrinking principalID to UUID. --- .../Friends/FriendsServerPostHandler.cs | 19 ++++++++++++--- .../Friends/FriendsServiceConnector.cs | 24 +++++++++---------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs index 9969086a90..fc97d8c221 100644 --- a/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Friends/FriendsServerPostHandler.cs @@ -160,9 +160,9 @@ namespace OpenSim.Server.Handlers.Friends byte[] StoreFriend(Dictionary request) { - FriendInfo friend = new FriendInfo(request); - - bool success = m_FriendsService.StoreFriend(friend.PrincipalID.ToString(), friend.Friend, friend.MyFlags); + string principalID = string.Empty, friend = string.Empty; int flags = 0; + FromKeyValuePairs(request, out principalID, out friend, out flags); + bool success = m_FriendsService.StoreFriend(principalID, friend, flags); if (success) return SuccessResult(); @@ -275,6 +275,19 @@ namespace OpenSim.Server.Handlers.Friends return ms.ToArray(); } + void FromKeyValuePairs(Dictionary kvp, out string principalID, out string friend, out int flags) + { + principalID = string.Empty; + if (kvp.ContainsKey("PrincipalID") && kvp["PrincipalID"] != null) + principalID = kvp["PrincipalID"].ToString(); + friend = string.Empty; + if (kvp.ContainsKey("Friend") && kvp["Friend"] != null) + friend = kvp["Friend"].ToString(); + flags = 0; + if (kvp.ContainsKey("MyFlags") && kvp["MyFlags"] != null) + Int32.TryParse(kvp["MyFlags"].ToString(), out flags); + } + #endregion } } diff --git a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs index 08f1dc3133..c5ae0c056e 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsServiceConnector.cs @@ -161,19 +161,8 @@ namespace OpenSim.Services.Connectors.Friends public bool StoreFriend(string PrincipalID, string Friend, int flags) { - FriendInfo finfo = new FriendInfo(); - try - { - finfo.PrincipalID = new UUID(PrincipalID); - } - catch - { - return false; - } - finfo.Friend = Friend; - finfo.MyFlags = flags; - Dictionary sendData = finfo.ToKeyValuePairs(); + Dictionary sendData = ToKeyValuePairs(PrincipalID, Friend, flags); sendData["METHOD"] = "storefriend"; @@ -267,5 +256,16 @@ namespace OpenSim.Services.Connectors.Friends } #endregion + + public Dictionary ToKeyValuePairs(string principalID, string friend, int flags) + { + Dictionary result = new Dictionary(); + result["PrincipalID"] = principalID; + result["Friend"] = friend; + result["MyFlags"] = flags; + + return result; + } + } } \ No newline at end of file From 4696a9c95eaf87e5cb43cdba008d3f41a949d629 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 08:13:54 -0700 Subject: [PATCH 09/13] Bug fix on HG IM. --- .../InstantMessage/HGMessageTransferModule.cs | 8 ++++-- .../HGInstantMessageService.cs | 26 +++++++++---------- .../Services/Interfaces/IHypergridServices.cs | 2 +- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs index e0c404bba1..4de197e10d 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/HGMessageTransferModule.cs @@ -187,12 +187,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage // Is the user a local user? UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, toAgentID); string url = string.Empty; + bool foreigner = false; if (account == null) // foreign user + { url = UserManagementModule.GetUserServerURL(toAgentID, "IMServerURI"); + foreigner = true; + } Util.FireAndForget(delegate { - bool success = m_IMService.OutgoingInstantMessage(im, url); + bool success = m_IMService.OutgoingInstantMessage(im, url, foreigner); if (!success && account == null) { // One last chance @@ -203,7 +207,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage UUID id; string u = string.Empty, first = string.Empty, last = string.Empty, secret = string.Empty; if (Util.ParseUniversalUserIdentifier(recipientUUI, out id, out u, out first, out last, out secret)) { - success = m_IMService.OutgoingInstantMessage(im, u); + success = m_IMService.OutgoingInstantMessage(im, u, true); if (success) UserManagementModule.AddUser(toAgentID, u + ";" + first + " " + last); } diff --git a/OpenSim/Services/HypergridService/HGInstantMessageService.cs b/OpenSim/Services/HypergridService/HGInstantMessageService.cs index dd5fd71baf..4f68e551d1 100644 --- a/OpenSim/Services/HypergridService/HGInstantMessageService.cs +++ b/OpenSim/Services/HypergridService/HGInstantMessageService.cs @@ -115,23 +115,23 @@ namespace OpenSim.Services.HypergridService return m_IMSimConnector.SendInstantMessage(im); } else - return TrySendInstantMessage(im, "", true); + return TrySendInstantMessage(im, "", true, false); } - public bool OutgoingInstantMessage(GridInstantMessage im, string url) + public bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner) { m_log.DebugFormat("[HG IM SERVICE]: Sending message from {0} to {1}@{2}", im.fromAgentID, im.toAgentID, url); if (url != string.Empty) - return TrySendInstantMessage(im, url, true); + return TrySendInstantMessage(im, url, true, foreigner); else { PresenceInfo upd = new PresenceInfo(); upd.RegionID = UUID.Zero; - return TrySendInstantMessage(im, upd, true); + return TrySendInstantMessage(im, upd, true, foreigner); } } - protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime) + protected bool TrySendInstantMessage(GridInstantMessage im, object previousLocation, bool firstTime, bool foreigner) { UUID toAgentID = new UUID(im.toAgentID); @@ -185,7 +185,7 @@ namespace OpenSim.Services.HypergridService } } - if (upd == null) + if (upd == null && !foreigner) { // Let's check with the UAS if the user is elsewhere m_log.DebugFormat("[HG IM SERVICE]: User is not present. Checking location with User Agent service"); @@ -213,25 +213,25 @@ namespace OpenSim.Services.HypergridService // ok, the user is around somewhere. Let's send back the reply with "success" // even though the IM may still fail. Just don't keep the caller waiting for // the entire time we're trying to deliver the IM - return SendIMToRegion(upd, im, toAgentID); + return SendIMToRegion(upd, im, toAgentID, foreigner); } else if (url != string.Empty) { // ok, the user is around somewhere. Let's send back the reply with "success" // even though the IM may still fail. Just don't keep the caller waiting for // the entire time we're trying to deliver the IM - return ForwardIMToGrid(url, im, toAgentID); + return ForwardIMToGrid(url, im, toAgentID, foreigner); } else if (firstTime && previousLocation is string && (string)previousLocation != string.Empty) { - return ForwardIMToGrid((string)previousLocation, im, toAgentID); + return ForwardIMToGrid((string)previousLocation, im, toAgentID, foreigner); } else m_log.DebugFormat("[HG IM SERVICE]: Unable to locate user {0}", toAgentID); return false; } - bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID) + bool SendIMToRegion(PresenceInfo upd, GridInstantMessage im, UUID toAgentID, bool foreigner) { bool imresult = false; GridRegion reginfo = null; @@ -277,11 +277,11 @@ namespace OpenSim.Services.HypergridService // The version that spawns the thread is SendGridInstantMessageViaXMLRPC // This is recursive!!!!! - return TrySendInstantMessage(im, upd, false); + return TrySendInstantMessage(im, upd, false, foreigner); } } - bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID) + bool ForwardIMToGrid(string url, GridInstantMessage im, UUID toAgentID, bool foreigner) { if (InstantMessageServiceConnector.SendInstantMessage(url, im)) { @@ -309,7 +309,7 @@ namespace OpenSim.Services.HypergridService // The version that spawns the thread is SendGridInstantMessageViaXMLRPC // This is recursive!!!!! - return TrySendInstantMessage(im, url, false); + return TrySendInstantMessage(im, url, false, foreigner); } } diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index 753c20523c..82ec8ceee5 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -72,7 +72,7 @@ namespace OpenSim.Services.Interfaces public interface IInstantMessage { bool IncomingInstantMessage(GridInstantMessage im); - bool OutgoingInstantMessage(GridInstantMessage im, string url); + bool OutgoingInstantMessage(GridInstantMessage im, string url, bool foreigner); } public interface IFriendsSimConnector { From 3c15c0b2640b08f3786857837770dcdb53859fd4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 09:39:09 -0700 Subject: [PATCH 10/13] Added test IM client. --- .../Tests/Clients/InstantMessage/IMClient.cs | 75 +++++++++++++++++++ prebuild.xml | 26 +++++++ 2 files changed, 101 insertions(+) create mode 100644 OpenSim/Tests/Clients/InstantMessage/IMClient.cs diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs new file mode 100644 index 0000000000..506d17674c --- /dev/null +++ b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Text; +using System.Reflection; + +using OpenMetaverse; +using log4net; +using log4net.Appender; +using log4net.Layout; + +using OpenSim.Framework; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.InstantMessage; + +namespace OpenSim.Tests.Clients.InstantMessage +{ + public class IMClient + { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + public static void Main(string[] args) + { + ConsoleAppender consoleAppender = new ConsoleAppender(); + consoleAppender.Layout = + new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"); + log4net.Config.BasicConfigurator.Configure(consoleAppender); + + string serverURI = "http://grid.nebadon2025.homeftp.net:8002/"; + GridInstantMessage im = new GridInstantMessage(); + im.fromAgentID = new Guid(); + im.toAgentID = new Guid(); + im.message = "Hello"; + im.imSessionID = new Guid(); + + bool success = InstantMessageServiceConnector.SendInstantMessage(serverURI, im); + + if (success) + m_log.InfoFormat("[IM CLIENT]: Successfully IMed {0}", serverURI); + else + m_log.InfoFormat("[IM CLIENT]: failed to IM {0}", serverURI); + + System.Console.WriteLine("\n"); + } + + } +} diff --git a/prebuild.xml b/prebuild.xml index 1f620dc8b1..0bdd14db43 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2645,6 +2645,32 @@ + + + + ../../../../bin/ + + + + + ../../../../bin/ + + + + ../../../../bin/ + + + + + + + + + + + + + From 65c71050cceb1a823fad682b906e0f8250f244c2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 09:39:29 -0700 Subject: [PATCH 11/13] Extra debug message --- .../Server/Handlers/Hypergrid/InstantMessageServerConnector.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs index 74b742280f..514793d86b 100644 --- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs @@ -72,6 +72,7 @@ namespace OpenSim.Server.Handlers.Hypergrid if (m_IMService == null) throw new Exception("InstantMessage server connector cannot proceed because of missing service"); + m_log.DebugFormat("[XXX] IM Server Connector is ON"); MainServer.Instance.AddXmlRPCHandler("grid_instant_message", ProcessInstantMessage, false); } From 6312eea459e6c64b6b5fafe06c9b8e6617bb03c3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 10:14:26 -0700 Subject: [PATCH 12/13] HG IM bug fix: grid_instant_message was being placed in the default port instead of the specified one. --- .../Server/Handlers/Hypergrid/InstantMessageServerConnector.cs | 3 +-- OpenSim/Tests/Clients/InstantMessage/IMClient.cs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs index 514793d86b..80eb5d2faf 100644 --- a/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/InstantMessageServerConnector.cs @@ -72,8 +72,7 @@ namespace OpenSim.Server.Handlers.Hypergrid if (m_IMService == null) throw new Exception("InstantMessage server connector cannot proceed because of missing service"); - m_log.DebugFormat("[XXX] IM Server Connector is ON"); - MainServer.Instance.AddXmlRPCHandler("grid_instant_message", ProcessInstantMessage, false); + server.AddXmlRPCHandler("grid_instant_message", ProcessInstantMessage, false); } diff --git a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs index 506d17674c..e7304a24dc 100644 --- a/OpenSim/Tests/Clients/InstantMessage/IMClient.cs +++ b/OpenSim/Tests/Clients/InstantMessage/IMClient.cs @@ -54,7 +54,7 @@ namespace OpenSim.Tests.Clients.InstantMessage new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline"); log4net.Config.BasicConfigurator.Configure(consoleAppender); - string serverURI = "http://grid.nebadon2025.homeftp.net:8002/"; + string serverURI = "http://127.0.0.1:8002"; GridInstantMessage im = new GridInstantMessage(); im.fromAgentID = new Guid(); im.toAgentID = new Guid(); From 2a12d143c2a3fa996674ee77a34a82100da17230 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 2 Jun 2011 10:44:10 -0700 Subject: [PATCH 13/13] HG IM: increase the timeout value --- .../Connectors/InstantMessage/InstantMessageServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs b/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs index 161be02e26..dbce9f613c 100644 --- a/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs +++ b/OpenSim/Services/Connectors/InstantMessage/InstantMessageServiceConnector.cs @@ -61,7 +61,7 @@ namespace OpenSim.Services.Connectors.InstantMessage try { - XmlRpcResponse GridResp = GridReq.Send(url, 3000); + XmlRpcResponse GridResp = GridReq.Send(url, 10000); Hashtable responseData = (Hashtable)GridResp.Value;