aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/WebUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-rw-r--r--OpenSim/Framework/WebUtil.cs33
1 files changed, 24 insertions, 9 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 4599f62..312e9a9 100644
--- a/OpenSim/Framework/WebUtil.cs
+++ b/OpenSim/Framework/WebUtil.cs
@@ -272,6 +272,7 @@ namespace OpenSim.Framework
272 catch (Exception ex) 272 catch (Exception ex)
273 { 273 {
274 errorMessage = ex.Message; 274 errorMessage = ex.Message;
275 m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString());
275 } 276 }
276 finally 277 finally
277 { 278 {
@@ -355,7 +356,7 @@ namespace OpenSim.Framework
355 /// </summary> 356 /// </summary>
356 public static OSDMap PostToService(string url, NameValueCollection data) 357 public static OSDMap PostToService(string url, NameValueCollection data)
357 { 358 {
358 return ServiceFormRequest(url,data,10000); 359 return ServiceFormRequest(url,data, 20000);
359 } 360 }
360 361
361 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) 362 public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
@@ -773,7 +774,8 @@ namespace OpenSim.Framework
773 reqnum, verb, requestUrl); 774 reqnum, verb, requestUrl);
774 775
775 int tickstart = Util.EnvironmentTickCount(); 776 int tickstart = Util.EnvironmentTickCount();
776 int tickdata = 0; 777// int tickdata = 0;
778 int tickdiff = 0;
777 779
778 Type type = typeof(TRequest); 780 Type type = typeof(TRequest);
779 781
@@ -819,8 +821,8 @@ namespace OpenSim.Framework
819 requestStream.Close(); 821 requestStream.Close();
820 822
821 // capture how much time was spent writing 823 // capture how much time was spent writing
822 tickdata = Util.EnvironmentTickCountSubtract(tickstart); 824 // useless in this async
823 825// tickdata = Util.EnvironmentTickCountSubtract(tickstart);
824 request.BeginGetResponse(delegate(IAsyncResult ar) 826 request.BeginGetResponse(delegate(IAsyncResult ar)
825 { 827 {
826 response = request.EndGetResponse(ar); 828 response = request.EndGetResponse(ar);
@@ -837,7 +839,8 @@ namespace OpenSim.Framework
837 finally 839 finally
838 { 840 {
839 // Let's not close this 841 // Let's not close this
840 //buffer.Close(); 842 // yes do close it
843 buffer.Close();
841 respStream.Close(); 844 respStream.Close();
842 response.Close(); 845 response.Close();
843 } 846 }
@@ -906,7 +909,6 @@ namespace OpenSim.Framework
906 } 909 }
907 910
908 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); 911 // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString());
909
910 try 912 try
911 { 913 {
912 action(deserial); 914 action(deserial);
@@ -921,9 +923,10 @@ namespace OpenSim.Framework
921 }, null); 923 }, null);
922 } 924 }
923 925
924 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); 926 tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
925 if (tickdiff > WebUtil.LongCallTime) 927 if (tickdiff > WebUtil.LongCallTime)
926 { 928 {
929/*
927 string originalRequest = null; 930 string originalRequest = null;
928 931
929 if (buffer != null) 932 if (buffer != null)
@@ -942,12 +945,19 @@ namespace OpenSim.Framework
942 tickdiff, 945 tickdiff,
943 tickdata, 946 tickdata,
944 originalRequest); 947 originalRequest);
948*/
949 m_log.InfoFormat(
950 "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms",
951 reqnum,
952 verb,
953 requestUrl,
954 tickdiff);
945 } 955 }
946 else if (WebUtil.DebugLevel >= 4) 956 else if (WebUtil.DebugLevel >= 4)
947 { 957 {
948 m_log.DebugFormat( 958 m_log.DebugFormat(
949 "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", 959 "[WEB UTIL]: HTTP OUT {0} took {1}ms",
950 reqnum, tickdiff, tickdata); 960 reqnum, tickdiff);
951 } 961 }
952 } 962 }
953 } 963 }
@@ -982,6 +992,8 @@ namespace OpenSim.Framework
982 request.Method = verb; 992 request.Method = verb;
983 string respstring = String.Empty; 993 string respstring = String.Empty;
984 994
995 int tickset = Util.EnvironmentTickCountSubtract(tickstart);
996
985 using (MemoryStream buffer = new MemoryStream()) 997 using (MemoryStream buffer = new MemoryStream())
986 { 998 {
987 if ((verb == "POST") || (verb == "PUT")) 999 if ((verb == "POST") || (verb == "PUT"))
@@ -1064,6 +1076,7 @@ namespace OpenSim.Framework
1064 verb, 1076 verb,
1065 requestUrl, 1077 requestUrl,
1066 tickdiff, 1078 tickdiff,
1079 tickset,
1067 tickdata, 1080 tickdata,
1068 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1081 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1069 else if (WebUtil.DebugLevel >= 4) 1082 else if (WebUtil.DebugLevel >= 4)
@@ -1122,6 +1135,8 @@ namespace OpenSim.Framework
1122 ht.ServicePoint.ConnectionLimit = maxConnections; 1135 ht.ServicePoint.ConnectionLimit = maxConnections;
1123 1136
1124 request.Method = verb; 1137 request.Method = verb;
1138 if (pTimeout != 0)
1139 request.Timeout = pTimeout * 1000;
1125 MemoryStream buffer = null; 1140 MemoryStream buffer = null;
1126 1141
1127 if ((verb == "POST") || (verb == "PUT")) 1142 if ((verb == "POST") || (verb == "PUT"))