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 701fbb0..bf57fd4 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 | } |
@@ -862,7 +865,6 @@ namespace OpenSim.Framework | |||
862 | } | 865 | } |
863 | 866 | ||
864 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 867 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
865 | |||
866 | try | 868 | try |
867 | { | 869 | { |
868 | action(deserial); | 870 | action(deserial); |
@@ -877,9 +879,10 @@ namespace OpenSim.Framework | |||
877 | }, null); | 879 | }, null); |
878 | } | 880 | } |
879 | 881 | ||
880 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 882 | tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
881 | if (tickdiff > WebUtil.LongCallTime) | 883 | if (tickdiff > WebUtil.LongCallTime) |
882 | { | 884 | { |
885 | /* | ||
883 | string originalRequest = null; | 886 | string originalRequest = null; |
884 | 887 | ||
885 | if (buffer != null) | 888 | if (buffer != null) |
@@ -898,12 +901,19 @@ namespace OpenSim.Framework | |||
898 | tickdiff, | 901 | tickdiff, |
899 | tickdata, | 902 | tickdata, |
900 | originalRequest); | 903 | originalRequest); |
904 | */ | ||
905 | m_log.InfoFormat( | ||
906 | "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", | ||
907 | reqnum, | ||
908 | verb, | ||
909 | requestUrl, | ||
910 | tickdiff); | ||
901 | } | 911 | } |
902 | else if (WebUtil.DebugLevel >= 4) | 912 | else if (WebUtil.DebugLevel >= 4) |
903 | { | 913 | { |
904 | m_log.DebugFormat( | 914 | m_log.DebugFormat( |
905 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | 915 | "[WEB UTIL]: HTTP OUT {0} took {1}ms", |
906 | reqnum, tickdiff, tickdata); | 916 | reqnum, tickdiff); |
907 | } | 917 | } |
908 | } | 918 | } |
909 | } | 919 | } |
@@ -938,6 +948,8 @@ namespace OpenSim.Framework | |||
938 | request.Method = verb; | 948 | request.Method = verb; |
939 | string respstring = String.Empty; | 949 | string respstring = String.Empty; |
940 | 950 | ||
951 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | ||
952 | |||
941 | using (MemoryStream buffer = new MemoryStream()) | 953 | using (MemoryStream buffer = new MemoryStream()) |
942 | { | 954 | { |
943 | if ((verb == "POST") || (verb == "PUT")) | 955 | if ((verb == "POST") || (verb == "PUT")) |
@@ -1017,6 +1029,7 @@ namespace OpenSim.Framework | |||
1017 | verb, | 1029 | verb, |
1018 | requestUrl, | 1030 | requestUrl, |
1019 | tickdiff, | 1031 | tickdiff, |
1032 | tickset, | ||
1020 | tickdata, | 1033 | tickdata, |
1021 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1034 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1022 | else if (WebUtil.DebugLevel >= 4) | 1035 | else if (WebUtil.DebugLevel >= 4) |
@@ -1075,6 +1088,8 @@ namespace OpenSim.Framework | |||
1075 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1088 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1076 | 1089 | ||
1077 | request.Method = verb; | 1090 | request.Method = verb; |
1091 | if (pTimeout != 0) | ||
1092 | request.Timeout = pTimeout * 1000; | ||
1078 | MemoryStream buffer = null; | 1093 | MemoryStream buffer = null; |
1079 | 1094 | ||
1080 | if ((verb == "POST") || (verb == "PUT")) | 1095 | if ((verb == "POST") || (verb == "PUT")) |