aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-10-05 00:14:49 +0100
committerUbitUmarov2012-10-05 00:14:49 +0100
commitdb00402fa86db6c3d945a48df13e266506e61486 (patch)
treea77b0b948ceb2d04f59f137e49138bbb41c2e45d /OpenSim/Framework/WebUtil.cs
parent more changes and more non active code (diff)
downloadopensim-SC-db00402fa86db6c3d945a48df13e266506e61486.zip
opensim-SC-db00402fa86db6c3d945a48df13e266506e61486.tar.gz
opensim-SC-db00402fa86db6c3d945a48df13e266506e61486.tar.bz2
opensim-SC-db00402fa86db6c3d945a48df13e266506e61486.tar.xz
make sure a buffer is closed, and changed a misleading log msg
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/WebUtil.cs28
1 files changed, 20 insertions, 8 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 8094b6d..30a8c28 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -706,9 +706,10 @@ namespace OpenSim.Framework
706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); 706 // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method);
707 707
708 int tickstart = Util.EnvironmentTickCount(); 708 int tickstart = Util.EnvironmentTickCount();
709 int tickdata = 0; 709// int tickdata = 0;
710 int tickdiff = 0;
710 711
711 // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); 712// m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl);
712 713
713 Type type = typeof(TRequest); 714 Type type = typeof(TRequest);
714 715
@@ -751,8 +752,8 @@ namespace OpenSim.Framework
751 requestStream.Close(); 752 requestStream.Close();
752 753
753 // capture how much time was spent writing 754 // capture how much time was spent writing
754 tickdata = Util.EnvironmentTickCountSubtract(tickstart); 755 // useless in this async
755 756// tickdata = Util.EnvironmentTickCountSubtract(tickstart);
756 request.BeginGetResponse(delegate(IAsyncResult ar) 757 request.BeginGetResponse(delegate(IAsyncResult ar)
757 { 758 {
758 response = request.EndGetResponse(ar); 759 response = request.EndGetResponse(ar);
@@ -769,7 +770,8 @@ namespace OpenSim.Framework
769 finally 770 finally
770 { 771 {
771 // Let's not close this 772 // Let's not close this
772 //buffer.Close(); 773 // yes do close it
774 buffer.Close();
773 respStream.Close(); 775 respStream.Close();
774 response.Close(); 776 response.Close();
775 } 777 }
@@ -837,7 +839,6 @@ namespace OpenSim.Framework
837 } 839 }
838 840
839 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); 841 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
840
841 try 842 try
842 { 843 {
843 action(deserial); 844 action(deserial);
@@ -852,9 +853,10 @@ namespace OpenSim.Framework
852 }, null); 853 }, null);
853 } 854 }
854 855
855 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 856 tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
856 if (tickdiff > WebUtil.LongCallTime) 857 if (tickdiff > WebUtil.LongCallTime)
857 { 858 {
859/*
858 string originalRequest = null; 860 string originalRequest = null;
859 861
860 if (buffer != null) 862 if (buffer != null)
@@ -873,6 +875,13 @@ namespace OpenSim.Framework
873 tickdiff, 875 tickdiff,
874 tickdata, 876 tickdata,
875 originalRequest); 877 originalRequest);
878*/
879 m_log.InfoFormat(
880 "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms",
881 reqnum,
882 verb,
883 requestUrl,
884 tickdiff);
876 } 885 }
877 } 886 }
878 } 887 }
@@ -903,6 +912,8 @@ namespace OpenSim.Framework
903 request.Method = verb; 912 request.Method = verb;
904 string respstring = String.Empty; 913 string respstring = String.Empty;
905 914
915 int tickset = Util.EnvironmentTickCountSubtract(tickstart);
916
906 using (MemoryStream buffer = new MemoryStream()) 917 using (MemoryStream buffer = new MemoryStream())
907 { 918 {
908 if ((verb == "POST") || (verb == "PUT")) 919 if ((verb == "POST") || (verb == "PUT"))
@@ -979,11 +990,12 @@ namespace OpenSim.Framework
979 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 990 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
980 if (tickdiff > WebUtil.LongCallTime) 991 if (tickdiff > WebUtil.LongCallTime)
981 m_log.InfoFormat( 992 m_log.InfoFormat(
982 "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms, {4}ms writing, {5}", 993 "[FORMS]: Slow request to <{0}> {1} {2} took {3}ms {4}ms writing {5}",
983 reqnum, 994 reqnum,
984 verb, 995 verb,
985 requestUrl, 996 requestUrl,
986 tickdiff, 997 tickdiff,
998 tickset,
987 tickdata, 999 tickdata,
988 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1000 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
989 1001