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 6fb1e0c..dfa37ca 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 }
@@ -985,6 +995,8 @@ namespace OpenSim.Framework
985 request.Timeout = timeoutsecs * 1000; 995 request.Timeout = timeoutsecs * 1000;
986 string respstring = String.Empty; 996 string respstring = String.Empty;
987 997
998 int tickset = Util.EnvironmentTickCountSubtract(tickstart);
999
988 using (MemoryStream buffer = new MemoryStream()) 1000 using (MemoryStream buffer = new MemoryStream())
989 { 1001 {
990 if ((verb == "POST") || (verb == "PUT")) 1002 if ((verb == "POST") || (verb == "PUT"))
@@ -1067,6 +1079,7 @@ namespace OpenSim.Framework
1067 verb, 1079 verb,
1068 requestUrl, 1080 requestUrl,
1069 tickdiff, 1081 tickdiff,
1082 tickset,
1070 tickdata, 1083 tickdata,
1071 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); 1084 obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj);
1072 else if (WebUtil.DebugLevel >= 4) 1085 else if (WebUtil.DebugLevel >= 4)
@@ -1130,6 +1143,8 @@ namespace OpenSim.Framework
1130 ht.ServicePoint.ConnectionLimit = maxConnections; 1143 ht.ServicePoint.ConnectionLimit = maxConnections;
1131 1144
1132 request.Method = verb; 1145 request.Method = verb;
1146 if (pTimeout != 0)
1147 request.Timeout = pTimeout * 1000;
1133 MemoryStream buffer = null; 1148 MemoryStream buffer = null;
1134 1149
1135 if ((verb == "POST") || (verb == "PUT")) 1150 if ((verb == "POST") || (verb == "PUT"))