From 30aac00f6bb24e0aed2e8a49907e0c4c573febfd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Oct 2009 10:12:19 -0700 Subject: Closing more streams even if things fail. --- .../Communications/Clients/RegionClient.cs | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/Communications/Clients') diff --git a/OpenSim/Framework/Communications/Clients/RegionClient.cs b/OpenSim/Framework/Communications/Clients/RegionClient.cs index 3419ce2..10be069 100644 --- a/OpenSim/Framework/Communications/Clients/RegionClient.cs +++ b/OpenSim/Framework/Communications/Clients/RegionClient.cs @@ -106,7 +106,6 @@ namespace OpenSim.Framework.Communications.Clients AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send os = AgentCreateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); //m_log.InfoFormat("[REST COMMS]: Posted CreateChildAgent request to remote sim {0}", uri); } //catch (WebException ex) @@ -116,6 +115,11 @@ namespace OpenSim.Framework.Communications.Clients reason = "cannot contact remote region"; return false; } + finally + { + if (os != null) + os.Close(); + } // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); @@ -224,7 +228,6 @@ namespace OpenSim.Framework.Communications.Clients ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send os = ChildUpdateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); } //catch (WebException ex) @@ -234,6 +237,11 @@ namespace OpenSim.Framework.Communications.Clients return false; } + finally + { + if (os != null) + os.Close(); + } // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); @@ -437,7 +445,6 @@ namespace OpenSim.Framework.Communications.Clients ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send os = ObjectCreateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); } //catch (WebException ex) @@ -447,6 +454,11 @@ namespace OpenSim.Framework.Communications.Clients return false; } + finally + { + if (os != null) + os.Close(); + } // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); @@ -512,7 +524,6 @@ namespace OpenSim.Framework.Communications.Clients ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send os = ObjectCreateRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); } //catch (WebException ex) @@ -522,6 +533,11 @@ namespace OpenSim.Framework.Communications.Clients return false; } + finally + { + if (os != null) + os.Close(); + } // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); @@ -597,7 +613,6 @@ namespace OpenSim.Framework.Communications.Clients HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send os = HelloNeighbourRequest.GetRequestStream(); os.Write(buffer, 0, strBuffer.Length); //Send it - os.Close(); //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); } //catch (WebException ex) @@ -607,7 +622,11 @@ namespace OpenSim.Framework.Communications.Clients return false; } - + finally + { + if (os != null) + os.Close(); + } // Let's wait for the response //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); -- cgit v1.1