aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2009-10-04 10:12:19 -0700
committerDiva Canto2009-10-04 10:12:19 -0700
commit30aac00f6bb24e0aed2e8a49907e0c4c573febfd (patch)
tree66e7593ab76b0062873996e6c85c5af1df624ecb
parentStream needs to be closed before the file can be moved... (diff)
downloadopensim-SC_OLD-30aac00f6bb24e0aed2e8a49907e0c4c573febfd.zip
opensim-SC_OLD-30aac00f6bb24e0aed2e8a49907e0c4c573febfd.tar.gz
opensim-SC_OLD-30aac00f6bb24e0aed2e8a49907e0c4c573febfd.tar.bz2
opensim-SC_OLD-30aac00f6bb24e0aed2e8a49907e0c4c573febfd.tar.xz
Closing more streams even if things fail.
-rw-r--r--OpenSim/Framework/Communications/Clients/RegionClient.cs31
1 files changed, 25 insertions, 6 deletions
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
106 AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send 106 AgentCreateRequest.ContentLength = buffer.Length; //Count bytes to send
107 os = AgentCreateRequest.GetRequestStream(); 107 os = AgentCreateRequest.GetRequestStream();
108 os.Write(buffer, 0, strBuffer.Length); //Send it 108 os.Write(buffer, 0, strBuffer.Length); //Send it
109 os.Close();
110 //m_log.InfoFormat("[REST COMMS]: Posted CreateChildAgent request to remote sim {0}", uri); 109 //m_log.InfoFormat("[REST COMMS]: Posted CreateChildAgent request to remote sim {0}", uri);
111 } 110 }
112 //catch (WebException ex) 111 //catch (WebException ex)
@@ -116,6 +115,11 @@ namespace OpenSim.Framework.Communications.Clients
116 reason = "cannot contact remote region"; 115 reason = "cannot contact remote region";
117 return false; 116 return false;
118 } 117 }
118 finally
119 {
120 if (os != null)
121 os.Close();
122 }
119 123
120 // Let's wait for the response 124 // Let's wait for the response
121 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); 125 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
@@ -224,7 +228,6 @@ namespace OpenSim.Framework.Communications.Clients
224 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send 228 ChildUpdateRequest.ContentLength = buffer.Length; //Count bytes to send
225 os = ChildUpdateRequest.GetRequestStream(); 229 os = ChildUpdateRequest.GetRequestStream();
226 os.Write(buffer, 0, strBuffer.Length); //Send it 230 os.Write(buffer, 0, strBuffer.Length); //Send it
227 os.Close();
228 //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); 231 //m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
229 } 232 }
230 //catch (WebException ex) 233 //catch (WebException ex)
@@ -234,6 +237,11 @@ namespace OpenSim.Framework.Communications.Clients
234 237
235 return false; 238 return false;
236 } 239 }
240 finally
241 {
242 if (os != null)
243 os.Close();
244 }
237 245
238 // Let's wait for the response 246 // Let's wait for the response
239 //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate"); 247 //m_log.Info("[REST COMMS]: Waiting for a reply after ChildAgentUpdate");
@@ -437,7 +445,6 @@ namespace OpenSim.Framework.Communications.Clients
437 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send 445 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
438 os = ObjectCreateRequest.GetRequestStream(); 446 os = ObjectCreateRequest.GetRequestStream();
439 os.Write(buffer, 0, strBuffer.Length); //Send it 447 os.Write(buffer, 0, strBuffer.Length); //Send it
440 os.Close();
441 m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri); 448 m_log.InfoFormat("[REST COMMS]: Posted ChildAgentUpdate request to remote sim {0}", uri);
442 } 449 }
443 //catch (WebException ex) 450 //catch (WebException ex)
@@ -447,6 +454,11 @@ namespace OpenSim.Framework.Communications.Clients
447 454
448 return false; 455 return false;
449 } 456 }
457 finally
458 {
459 if (os != null)
460 os.Close();
461 }
450 462
451 // Let's wait for the response 463 // Let's wait for the response
452 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); 464 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
@@ -512,7 +524,6 @@ namespace OpenSim.Framework.Communications.Clients
512 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send 524 ObjectCreateRequest.ContentLength = buffer.Length; //Count bytes to send
513 os = ObjectCreateRequest.GetRequestStream(); 525 os = ObjectCreateRequest.GetRequestStream();
514 os.Write(buffer, 0, strBuffer.Length); //Send it 526 os.Write(buffer, 0, strBuffer.Length); //Send it
515 os.Close();
516 //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri); 527 //m_log.InfoFormat("[REST COMMS]: Posted CreateObject request to remote sim {0}", uri);
517 } 528 }
518 //catch (WebException ex) 529 //catch (WebException ex)
@@ -522,6 +533,11 @@ namespace OpenSim.Framework.Communications.Clients
522 533
523 return false; 534 return false;
524 } 535 }
536 finally
537 {
538 if (os != null)
539 os.Close();
540 }
525 541
526 // Let's wait for the response 542 // Let's wait for the response
527 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall"); 543 //m_log.Info("[REST COMMS]: Waiting for a reply after DoCreateChildAgentCall");
@@ -597,7 +613,6 @@ namespace OpenSim.Framework.Communications.Clients
597 HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send 613 HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send
598 os = HelloNeighbourRequest.GetRequestStream(); 614 os = HelloNeighbourRequest.GetRequestStream();
599 os.Write(buffer, 0, strBuffer.Length); //Send it 615 os.Write(buffer, 0, strBuffer.Length); //Send it
600 os.Close();
601 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); 616 //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri);
602 } 617 }
603 //catch (WebException ex) 618 //catch (WebException ex)
@@ -607,7 +622,11 @@ namespace OpenSim.Framework.Communications.Clients
607 622
608 return false; 623 return false;
609 } 624 }
610 625 finally
626 {
627 if (os != null)
628 os.Close();
629 }
611 // Let's wait for the response 630 // Let's wait for the response
612 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); 631 //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall");
613 632