diff options
Diffstat (limited to 'OpenSim/Framework/WebUtil.cs')
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 5c34cf4..b85d93d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -235,6 +235,7 @@ namespace OpenSim.Framework | |||
235 | catch (Exception ex) | 235 | catch (Exception ex) |
236 | { | 236 | { |
237 | errorMessage = ex.Message; | 237 | errorMessage = ex.Message; |
238 | m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString()); | ||
238 | } | 239 | } |
239 | finally | 240 | finally |
240 | { | 241 | { |
@@ -318,7 +319,7 @@ namespace OpenSim.Framework | |||
318 | /// </summary> | 319 | /// </summary> |
319 | public static OSDMap PostToService(string url, NameValueCollection data) | 320 | public static OSDMap PostToService(string url, NameValueCollection data) |
320 | { | 321 | { |
321 | return ServiceFormRequest(url,data,10000); | 322 | return ServiceFormRequest(url,data, 20000); |
322 | } | 323 | } |
323 | 324 | ||
324 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) | 325 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) |
@@ -732,7 +733,8 @@ namespace OpenSim.Framework | |||
732 | reqnum, verb, requestUrl); | 733 | reqnum, verb, requestUrl); |
733 | 734 | ||
734 | int tickstart = Util.EnvironmentTickCount(); | 735 | int tickstart = Util.EnvironmentTickCount(); |
735 | int tickdata = 0; | 736 | // int tickdata = 0; |
737 | int tickdiff = 0; | ||
736 | 738 | ||
737 | Type type = typeof(TRequest); | 739 | Type type = typeof(TRequest); |
738 | 740 | ||
@@ -775,8 +777,8 @@ namespace OpenSim.Framework | |||
775 | requestStream.Close(); | 777 | requestStream.Close(); |
776 | 778 | ||
777 | // capture how much time was spent writing | 779 | // capture how much time was spent writing |
778 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | 780 | // useless in this async |
779 | 781 | // tickdata = Util.EnvironmentTickCountSubtract(tickstart); | |
780 | request.BeginGetResponse(delegate(IAsyncResult ar) | 782 | request.BeginGetResponse(delegate(IAsyncResult ar) |
781 | { | 783 | { |
782 | response = request.EndGetResponse(ar); | 784 | response = request.EndGetResponse(ar); |
@@ -793,7 +795,8 @@ namespace OpenSim.Framework | |||
793 | finally | 795 | finally |
794 | { | 796 | { |
795 | // Let's not close this | 797 | // Let's not close this |
796 | //buffer.Close(); | 798 | // yes do close it |
799 | buffer.Close(); | ||
797 | respStream.Close(); | 800 | respStream.Close(); |
798 | response.Close(); | 801 | response.Close(); |
799 | } | 802 | } |
@@ -861,7 +864,6 @@ namespace OpenSim.Framework | |||
861 | } | 864 | } |
862 | 865 | ||
863 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 866 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
864 | |||
865 | try | 867 | try |
866 | { | 868 | { |
867 | action(deserial); | 869 | action(deserial); |
@@ -876,9 +878,10 @@ namespace OpenSim.Framework | |||
876 | }, null); | 878 | }, null); |
877 | } | 879 | } |
878 | 880 | ||
879 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 881 | tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
880 | if (tickdiff > WebUtil.LongCallTime) | 882 | if (tickdiff > WebUtil.LongCallTime) |
881 | { | 883 | { |
884 | /* | ||
882 | string originalRequest = null; | 885 | string originalRequest = null; |
883 | 886 | ||
884 | if (buffer != null) | 887 | if (buffer != null) |
@@ -897,12 +900,19 @@ namespace OpenSim.Framework | |||
897 | tickdiff, | 900 | tickdiff, |
898 | tickdata, | 901 | tickdata, |
899 | originalRequest); | 902 | originalRequest); |
903 | */ | ||
904 | m_log.InfoFormat( | ||
905 | "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", | ||
906 | reqnum, | ||
907 | verb, | ||
908 | requestUrl, | ||
909 | tickdiff); | ||
900 | } | 910 | } |
901 | else if (WebUtil.DebugLevel >= 4) | 911 | else if (WebUtil.DebugLevel >= 4) |
902 | { | 912 | { |
903 | m_log.DebugFormat( | 913 | m_log.DebugFormat( |
904 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | 914 | "[WEB UTIL]: HTTP OUT {0} took {1}ms", |
905 | reqnum, tickdiff, tickdata); | 915 | reqnum, tickdiff); |
906 | } | 916 | } |
907 | } | 917 | } |
908 | } | 918 | } |
@@ -937,6 +947,8 @@ namespace OpenSim.Framework | |||
937 | request.Method = verb; | 947 | request.Method = verb; |
938 | string respstring = String.Empty; | 948 | string respstring = String.Empty; |
939 | 949 | ||
950 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | ||
951 | |||
940 | using (MemoryStream buffer = new MemoryStream()) | 952 | using (MemoryStream buffer = new MemoryStream()) |
941 | { | 953 | { |
942 | if ((verb == "POST") || (verb == "PUT")) | 954 | if ((verb == "POST") || (verb == "PUT")) |
@@ -1018,6 +1030,7 @@ namespace OpenSim.Framework | |||
1018 | verb, | 1030 | verb, |
1019 | requestUrl, | 1031 | requestUrl, |
1020 | tickdiff, | 1032 | tickdiff, |
1033 | tickset, | ||
1021 | tickdata, | 1034 | tickdata, |
1022 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1035 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1023 | else if (WebUtil.DebugLevel >= 4) | 1036 | else if (WebUtil.DebugLevel >= 4) |
@@ -1076,6 +1089,8 @@ namespace OpenSim.Framework | |||
1076 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1089 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1077 | 1090 | ||
1078 | request.Method = verb; | 1091 | request.Method = verb; |
1092 | if (pTimeout != 0) | ||
1093 | request.Timeout = pTimeout * 1000; | ||
1079 | MemoryStream buffer = null; | 1094 | MemoryStream buffer = null; |
1080 | 1095 | ||
1081 | if ((verb == "POST") || (verb == "PUT")) | 1096 | if ((verb == "POST") || (verb == "PUT")) |