From 9ae293881addf98844b8f292298bc0674ebbed0d Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 4 Sep 2012 22:53:52 +0200 Subject: Make friend notifies and closing child agents async because both can block the heartbeat thread if the sim being contacted is unresponsive --- .../Connectors/Friends/FriendsSimConnector.cs | 68 ++++++++++++---------- .../Simulation/SimulationServiceConnector.cs | 21 +++---- 2 files changed, 47 insertions(+), 42 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs index 3fd0c53..6cd21d1 100644 --- a/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs +++ b/OpenSim/Services/Connectors/Friends/FriendsSimConnector.cs @@ -144,44 +144,48 @@ namespace OpenSim.Services.Connectors.Friends private bool Call(GridRegion region, Dictionary sendData) { - string reqString = ServerUtils.BuildQueryString(sendData); - //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); - if (region == null) - return false; - - string path = ServicePath(); - if (!region.ServerURI.EndsWith("/")) - path = "/" + path; - string uri = region.ServerURI + path; - m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); - - try - { - string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); - if (reply != string.Empty) + Util.FireAndForget(x => { + string reqString = ServerUtils.BuildQueryString(sendData); + //m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: queryString = {0}", reqString); + if (region == null) + return; + + string path = ServicePath(); + if (!region.ServerURI.EndsWith("/")) + path = "/" + path; + string uri = region.ServerURI + path; + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: calling {0}", uri); + + try { - Dictionary replyData = ServerUtils.ParseXmlResponse(reply); - - if (replyData.ContainsKey("RESULT")) + string reply = SynchronousRestFormsRequester.MakeRequest("POST", uri, reqString); + if (reply != string.Empty) { - if (replyData["RESULT"].ToString().ToLower() == "true") - return true; + Dictionary replyData = ServerUtils.ParseXmlResponse(reply); + + if (replyData.ContainsKey("RESULT")) + { +// if (replyData["RESULT"].ToString().ToLower() == "true") +// return; +// else + return; + } else - return false; + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); + } else - m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: reply data does not contain result field"); - + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); + } + catch (Exception e) + { + m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); } - else - m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: received empty reply"); - } - catch (Exception e) - { - m_log.DebugFormat("[FRIENDS SIM CONNECTOR]: Exception when contacting remote sim at {0}: {1}", uri, e.Message); - } - - return false; + + return; + }); + + return true; } } } diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index e1c2243..508baf7 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -395,17 +395,18 @@ namespace OpenSim.Services.Connectors.Simulation private bool CloseAgent(GridRegion destination, UUID id, bool ChildOnly) { // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); + Util.FireAndForget(x => { + string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; - - try - { - WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); - } - catch (Exception e) - { - m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); - } + try + { + WebUtil.ServiceOSDRequest(uri, null, "DELETE", 10000, false); + } + catch (Exception e) + { + m_log.WarnFormat("[REMOTE SIMULATION CONNECTOR] CloseAgent failed with exception; {0}",e.ToString()); + } + }); return true; } -- cgit v1.1 From 041fcd6a72e1822656d58f87a398e3a0f065a486 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Sep 2012 17:18:34 +0100 Subject: remove extra '/' in assets url --- .../Connectors/Asset/AssetServicesConnector.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 45ebf3a..7ad6f0b 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,7 +181,8 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -218,7 +219,8 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } - string uri = MapServer(id) + "/assets/" + id + "/metadata"; +// string uri = MapServer(id) + "/assets/" + id + "/metadata"; + string uri = MapServer(id) + "assets/" + id + "/metadata"; AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -260,7 +262,8 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -379,7 +382,9 @@ namespace OpenSim.Services.Connectors return asset.ID; } - string uri = MapServer(asset.FullID.ToString()) + "/assets/"; +// string uri = MapServer(asset.FullID.ToString()) + "/assets/"; + + string uri = MapServer(asset.FullID.ToString()) + "assets/"; string newID = string.Empty; try @@ -456,7 +461,8 @@ namespace OpenSim.Services.Connectors } asset.Data = data; - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -471,7 +477,8 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { - string uri = MapServer(id) + "/assets/" + id; +// string uri = MapServer(id) + "/assets/" + id; + string uri = MapServer(id) + "assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From 27d345c9a0047af44296184557aed25719b2759e Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:02:55 +0200 Subject: Revert " remove extra '/' in assets url" This reverts commit 041fcd6a72e1822656d58f87a398e3a0f065a486. --- .../Connectors/Asset/AssetServicesConnector.cs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 7ad6f0b..45ebf3a 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,8 +181,7 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -219,8 +218,7 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } -// string uri = MapServer(id) + "/assets/" + id + "/metadata"; - string uri = MapServer(id) + "assets/" + id + "/metadata"; + string uri = MapServer(id) + "/assets/" + id + "/metadata"; AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -262,8 +260,7 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -382,9 +379,7 @@ namespace OpenSim.Services.Connectors return asset.ID; } -// string uri = MapServer(asset.FullID.ToString()) + "/assets/"; - - string uri = MapServer(asset.FullID.ToString()) + "assets/"; + string uri = MapServer(asset.FullID.ToString()) + "/assets/"; string newID = string.Empty; try @@ -461,8 +456,7 @@ namespace OpenSim.Services.Connectors } asset.Data = data; -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -477,8 +471,7 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { -// string uri = MapServer(id) + "/assets/" + id; - string uri = MapServer(id) + "assets/" + id; + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From b9d026666dbabb210cc013d29eb79fe214594dd9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:11:44 +0200 Subject: Change string concatenation to Path.Combine to eliminate extra slashes. Windoze barfs on them. --- .../Services/Connectors/Asset/AssetServicesConnector.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 45ebf3a..2a3dacc 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetBase asset = null; if (m_Cache != null) @@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } - string uri = MapServer(id) + "/assets/" + id + "/metadata"; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -260,7 +260,7 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); AssetBase asset = null; if (m_Cache != null) @@ -379,7 +379,9 @@ namespace OpenSim.Services.Connectors return asset.ID; } - string uri = MapServer(asset.FullID.ToString()) + "/assets/"; + string uri = Path.Combine(MapServer(asset.FullID.ToString()), "/assets/"); + if (!uri.EndsWith("/")) + uri += "/"; string newID = string.Empty; try @@ -456,7 +458,7 @@ namespace OpenSim.Services.Connectors } asset.Data = data; - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -471,7 +473,7 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { - string uri = MapServer(id) + "/assets/" + id; + string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From 3257f4d5d21116e9fb8e08f3277b3521d38bc11c Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:31:41 +0200 Subject: Revert "Change string concatenation to Path.Combine to eliminate extra slashes." This reverts commit b9d026666dbabb210cc013d29eb79fe214594dd9. --- .../Services/Connectors/Asset/AssetServicesConnector.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 2a3dacc..45ebf3a 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -181,7 +181,7 @@ namespace OpenSim.Services.Connectors public AssetBase Get(string id) { - string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors return fullAsset.Metadata; } - string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); + string uri = MapServer(id) + "/assets/" + id + "/metadata"; AssetMetadata asset = SynchronousRestObjectRequester. MakeRequest("GET", uri, 0); @@ -260,7 +260,7 @@ namespace OpenSim.Services.Connectors public bool Get(string id, Object sender, AssetRetrieved handler) { - string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); + string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; if (m_Cache != null) @@ -379,9 +379,7 @@ namespace OpenSim.Services.Connectors return asset.ID; } - string uri = Path.Combine(MapServer(asset.FullID.ToString()), "/assets/"); - if (!uri.EndsWith("/")) - uri += "/"; + string uri = MapServer(asset.FullID.ToString()) + "/assets/"; string newID = string.Empty; try @@ -458,7 +456,7 @@ namespace OpenSim.Services.Connectors } asset.Data = data; - string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("POST", uri, asset)) @@ -473,7 +471,7 @@ namespace OpenSim.Services.Connectors public bool Delete(string id) { - string uri = Path.Combine(MapServer(id), Path.Combine("assets", id)); + string uri = MapServer(id) + "/assets/" + id; if (SynchronousRestObjectRequester. MakeRequest("DELETE", uri, 0)) -- cgit v1.1 From ac6448810e999c4c0c0035fff43b45db9a094094 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 6 Sep 2012 17:39:30 +0200 Subject: Prevent double slashes, try #3 --- OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 45ebf3a..091e41a 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -126,6 +126,9 @@ namespace OpenSim.Services.Connectors // m_log.DebugFormat("[ASSET]: Using {0} for host name for prefix {1}", host, prefix); + string ret = serverUri.Uri.AbsoluteUri; + if (ret.EndsWith("/")) + ret = ret.Substring(0, ret.Length - 1); return serverUri.Uri.AbsoluteUri; } -- cgit v1.1 From f53ca6285bc21155a2fdad953b9063a4f8cd5d21 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 6 Sep 2012 18:41:21 +0100 Subject: Prevent double slashes, try #4 --- OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 091e41a..9e04601 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs @@ -129,7 +129,7 @@ namespace OpenSim.Services.Connectors string ret = serverUri.Uri.AbsoluteUri; if (ret.EndsWith("/")) ret = ret.Substring(0, ret.Length - 1); - return serverUri.Uri.AbsoluteUri; + return ret; } protected void retryCheck(object source, ElapsedEventArgs e) -- cgit v1.1