From 5f311c91c781d09e266fb76cb7747550fe2afc16 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 10 Jun 2011 21:07:50 -0700 Subject: More tweaking on the UserAgentServiceConnector: add constructor that does not do DNS lookup, and use that for friends notification. --- .../CoreModules/Avatar/Friends/HGFriendsModule.cs | 2 +- .../Hypergrid/UserAgentServiceConnector.cs | 35 ++++++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index b9d6719..b8342ef 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -278,7 +278,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends List ids = new List(); foreach (FriendInfo f in kvp.Value) ids.Add(f.Friend); - UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); + UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key, false); List friendsOnline = uConn.StatusNotification(ids, userID, online); // need to debug this here if (online) diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index b7e09e8..2a5fb40 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -51,22 +51,31 @@ namespace OpenSim.Services.Connectors.Hypergrid MethodBase.GetCurrentMethod().DeclaringType); string m_ServerURL; - public UserAgentServiceConnector(string url) + + public UserAgentServiceConnector(string url) : this(url, true) + { + } + + public UserAgentServiceConnector(string url, bool dnsLookup) { m_ServerURL = url; - // Doing this here, because XML-RPC or mono have some strong ideas about - // caching DNS translations. - try - { - Uri m_Uri = new Uri(m_ServerURL); - IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); - m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); - if (!m_ServerURL.EndsWith("/")) - m_ServerURL += "/"; - } - catch (Exception e) + + if (dnsLookup) { - m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); + // Doing this here, because XML-RPC or mono have some strong ideas about + // caching DNS translations. + try + { + Uri m_Uri = new Uri(m_ServerURL); + IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); + m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); + if (!m_ServerURL.EndsWith("/")) + m_ServerURL += "/"; + } + catch (Exception e) + { + m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", m_ServerURL, e.Message); + } } m_log.DebugFormat("[USER AGENT CONNECTOR]: new connector to {0} ({1})", url, m_ServerURL); } -- cgit v1.1