From b5b53dd3ebb331c5d235df161fe9cefc405c3660 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 6 Oct 2009 19:55:35 -0700 Subject: * One more debug message on FetchInventoryDescendants * More streams close on finally --- .../Communications/Clients/RegionClient.cs | 79 +++++++++++++++++----- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 1 + 2 files changed, 63 insertions(+), 17 deletions(-) diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 10be069..220a9b6 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -124,9 +124,11 @@ namespace OpenSim.Framework.Communications.Clients // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + WebResponse webResponse = null; + StreamReader sr = null; try { - WebResponse webResponse = AgentCreateRequest.GetResponse(); + webResponse = AgentCreateRequest.GetResponse(); if (webResponse == null) { m_log.Info("[REST COMMS]: Null reply on DoCreateChildAgentCall post"); @@ -134,11 +136,10 @@ namespace OpenSim.Framework.Communications.Clients else { - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); string response = sr.ReadToEnd().Trim(); - sr.Close(); m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", response); - + if (!String.IsNullOrEmpty(response)) { try @@ -167,6 +168,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateChildAgentCall {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; @@ -246,15 +252,17 @@ namespace OpenSim.Framework.Communications.Clients // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); + WebResponse webResponse = null; + StreamReader sr = null; try { - WebResponse webResponse = ChildUpdateRequest.GetResponse(); + webResponse = ChildUpdateRequest.GetResponse(); if (webResponse == null) { m_log.Info("[REST COMMS]: Null reply on ChilAgentUpdate post"); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); //reply = sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); sr.Close(); @@ -266,6 +274,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of ChilAgentUpdate {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; } @@ -284,6 +297,7 @@ namespace OpenSim.Framework.Communications.Clients HttpWebResponse webResponse = null; string reply = string.Empty; + StreamReader sr = null; try { webResponse = (HttpWebResponse)request.GetResponse(); @@ -292,9 +306,8 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on agent get "); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); reply = sr.ReadToEnd().Trim(); - sr.Close(); //Console.WriteLine("[REST COMMS]: ChilAgentUpdate reply was " + reply); @@ -305,6 +318,11 @@ namespace OpenSim.Framework.Communications.Clients // ignore, really return false; } + finally + { + if (sr != null) + sr.Close(); + } if (webResponse.StatusCode == HttpStatusCode.OK) { @@ -333,6 +351,7 @@ namespace OpenSim.Framework.Communications.Clients request.Method = "DELETE"; request.Timeout = 10000; + StreamReader sr = null; try { WebResponse webResponse = request.GetResponse(); @@ -341,7 +360,7 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on agent delete "); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); //reply = sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); sr.Close(); @@ -353,6 +372,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; } @@ -377,6 +401,7 @@ namespace OpenSim.Framework.Communications.Clients request.Method = "DELETE"; request.Timeout = 10000; + StreamReader sr = null; try { WebResponse webResponse = request.GetResponse(); @@ -385,7 +410,7 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on agent delete "); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); //reply = sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); sr.Close(); @@ -397,6 +422,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of agent delete {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; } @@ -463,6 +493,7 @@ namespace OpenSim.Framework.Communications.Clients // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + StreamReader sr = null; try { WebResponse webResponse = ObjectCreateRequest.GetResponse(); @@ -471,10 +502,9 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); //reply = sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); - sr.Close(); //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); } @@ -483,6 +513,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; @@ -542,6 +577,7 @@ namespace OpenSim.Framework.Communications.Clients // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); + StreamReader sr = null; try { WebResponse webResponse = ObjectCreateRequest.GetResponse(); @@ -550,11 +586,10 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on DoCreateObjectCall post"); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); - sr.Close(); - + //m_log.InfoFormat("[REST COMMS]: DoCreateChildAgentCall reply was {0} ", reply); } @@ -563,6 +598,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of DoCreateObjectCall {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; @@ -630,6 +670,7 @@ namespace OpenSim.Framework.Communications.Clients // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); + StreamReader sr = null; try { WebResponse webResponse = HelloNeighbourRequest.GetResponse(); @@ -638,10 +679,9 @@ namespace OpenSim.Framework.Communications.Clients m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); } - StreamReader sr = new StreamReader(webResponse.GetResponseStream()); + sr = new StreamReader(webResponse.GetResponseStream()); //reply = sr.ReadToEnd().Trim(); sr.ReadToEnd().Trim(); - sr.Close(); //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); } @@ -650,6 +690,11 @@ namespace OpenSim.Framework.Communications.Clients m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); // ignore, really } + finally + { + if (sr != null) + sr.Close(); + } return true; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a4460e4..1917228 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1168,6 +1168,7 @@ namespace OpenSim.Region.Framework.Scenes private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) { + m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName); InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, fetchFolders, fetchItems); } -- cgit v1.1