aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorUbitUmarov2014-09-17 15:36:22 +0100
committerUbitUmarov2014-09-17 15:36:22 +0100
commit9bf3e2a25745000fc9113c4b00f280fa67460601 (patch)
treee6d35f9c327e6ae16b8d8e443155e90677ee806b /OpenSim/Framework
parentturn off Nangle on users of ServivePointManager like webrequests (diff)
downloadopensim-SC_OLD-9bf3e2a25745000fc9113c4b00f280fa67460601.zip
opensim-SC_OLD-9bf3e2a25745000fc9113c4b00f280fa67460601.tar.gz
opensim-SC_OLD-9bf3e2a25745000fc9113c4b00f280fa67460601.tar.bz2
opensim-SC_OLD-9bf3e2a25745000fc9113c4b00f280fa67460601.tar.xz
dispose some tmp streams
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/RestClient.cs32
1 files changed, 18 insertions, 14 deletions
diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs
index 42c0b18..de34250 100644
--- a/OpenSim/Framework/Communications/RestClient.cs
+++ b/OpenSim/Framework/Communications/RestClient.cs
@@ -329,15 +329,16 @@ namespace OpenSim.Framework.Communications
329 return null; 329 return null;
330 } 330 }
331 331
332 Stream src = _response.GetResponseStream(); 332 using (Stream src = _response.GetResponseStream())
333 int length = src.Read(_readbuf, 0, BufferSize);
334 while (length > 0)
335 { 333 {
336 _resource.Write(_readbuf, 0, length); 334 int length = src.Read(_readbuf, 0, BufferSize);
337 length = src.Read(_readbuf, 0, BufferSize); 335 while (length > 0)
336 {
337 _resource.Write(_readbuf, 0, length);
338 length = src.Read(_readbuf, 0, BufferSize);
339 }
338 } 340 }
339 341
340
341 // TODO! Implement timeout, without killing the server 342 // TODO! Implement timeout, without killing the server
342 // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted 343 // this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
343 //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true); 344 //ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
@@ -372,16 +373,19 @@ namespace OpenSim.Framework.Communications
372 m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri()); 373 m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
373 src.Seek(0, SeekOrigin.Begin); 374 src.Seek(0, SeekOrigin.Begin);
374 m_log.Info("[REST]: Seek is ok"); 375 m_log.Info("[REST]: Seek is ok");
375 Stream dst = _request.GetRequestStream();
376 m_log.Info("[REST]: GetRequestStream is ok");
377 376
378 byte[] buf = new byte[1024]; 377 using (Stream dst = _request.GetRequestStream())
379 int length = src.Read(buf, 0, 1024);
380 m_log.Info("[REST]: First Read is ok");
381 while (length > 0)
382 { 378 {
383 dst.Write(buf, 0, length); 379 m_log.Info("[REST]: GetRequestStream is ok");
384 length = src.Read(buf, 0, 1024); 380
381 byte[] buf = new byte[1024];
382 int length = src.Read(buf, 0, 1024);
383 m_log.Info("[REST]: First Read is ok");
384 while (length > 0)
385 {
386 dst.Write(buf, 0, length);
387 length = src.Read(buf, 0, 1024);
388 }
385 } 389 }
386 390
387 _response = (HttpWebResponse) _request.GetResponse(); 391 _response = (HttpWebResponse) _request.GetResponse();