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 bcf6af8..33ef8e0 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -284,6 +284,7 @@ namespace OpenSim.Framework | |||
284 | catch (Exception ex) | 284 | catch (Exception ex) |
285 | { | 285 | { |
286 | errorMessage = ex.Message; | 286 | errorMessage = ex.Message; |
287 | m_log.Debug("[WEB UTIL]: Exception making request: " + ex.ToString()); | ||
287 | } | 288 | } |
288 | finally | 289 | finally |
289 | { | 290 | { |
@@ -367,7 +368,7 @@ namespace OpenSim.Framework | |||
367 | /// </summary> | 368 | /// </summary> |
368 | public static OSDMap PostToService(string url, NameValueCollection data) | 369 | public static OSDMap PostToService(string url, NameValueCollection data) |
369 | { | 370 | { |
370 | return ServiceFormRequest(url,data,10000); | 371 | return ServiceFormRequest(url,data, 20000); |
371 | } | 372 | } |
372 | 373 | ||
373 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) | 374 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) |
@@ -785,7 +786,8 @@ namespace OpenSim.Framework | |||
785 | reqnum, verb, requestUrl); | 786 | reqnum, verb, requestUrl); |
786 | 787 | ||
787 | int tickstart = Util.EnvironmentTickCount(); | 788 | int tickstart = Util.EnvironmentTickCount(); |
788 | int tickdata = 0; | 789 | // int tickdata = 0; |
790 | int tickdiff = 0; | ||
789 | 791 | ||
790 | Type type = typeof(TRequest); | 792 | Type type = typeof(TRequest); |
791 | 793 | ||
@@ -831,8 +833,8 @@ namespace OpenSim.Framework | |||
831 | requestStream.Close(); | 833 | requestStream.Close(); |
832 | 834 | ||
833 | // capture how much time was spent writing | 835 | // capture how much time was spent writing |
834 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | 836 | // useless in this async |
835 | 837 | // tickdata = Util.EnvironmentTickCountSubtract(tickstart); | |
836 | request.BeginGetResponse(delegate(IAsyncResult ar) | 838 | request.BeginGetResponse(delegate(IAsyncResult ar) |
837 | { | 839 | { |
838 | response = request.EndGetResponse(ar); | 840 | response = request.EndGetResponse(ar); |
@@ -849,7 +851,8 @@ namespace OpenSim.Framework | |||
849 | finally | 851 | finally |
850 | { | 852 | { |
851 | // Let's not close this | 853 | // Let's not close this |
852 | //buffer.Close(); | 854 | // yes do close it |
855 | buffer.Close(); | ||
853 | respStream.Close(); | 856 | respStream.Close(); |
854 | response.Close(); | 857 | response.Close(); |
855 | } | 858 | } |
@@ -918,7 +921,6 @@ namespace OpenSim.Framework | |||
918 | } | 921 | } |
919 | 922 | ||
920 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 923 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
921 | |||
922 | try | 924 | try |
923 | { | 925 | { |
924 | action(deserial); | 926 | action(deserial); |
@@ -933,9 +935,10 @@ namespace OpenSim.Framework | |||
933 | }, null); | 935 | }, null); |
934 | } | 936 | } |
935 | 937 | ||
936 | int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | 938 | tickdiff = Util.EnvironmentTickCountSubtract(tickstart); |
937 | if (tickdiff > WebUtil.LongCallTime) | 939 | if (tickdiff > WebUtil.LongCallTime) |
938 | { | 940 | { |
941 | /* | ||
939 | string originalRequest = null; | 942 | string originalRequest = null; |
940 | 943 | ||
941 | if (buffer != null) | 944 | if (buffer != null) |
@@ -954,12 +957,19 @@ namespace OpenSim.Framework | |||
954 | tickdiff, | 957 | tickdiff, |
955 | tickdata, | 958 | tickdata, |
956 | originalRequest); | 959 | originalRequest); |
960 | */ | ||
961 | m_log.InfoFormat( | ||
962 | "[ASYNC REQUEST]: Slow WebRequest SETUP <{0}> {1} {2} took {3}ms", | ||
963 | reqnum, | ||
964 | verb, | ||
965 | requestUrl, | ||
966 | tickdiff); | ||
957 | } | 967 | } |
958 | else if (WebUtil.DebugLevel >= 4) | 968 | else if (WebUtil.DebugLevel >= 4) |
959 | { | 969 | { |
960 | m_log.DebugFormat( | 970 | m_log.DebugFormat( |
961 | "[WEB UTIL]: HTTP OUT {0} took {1}ms, {2}ms writing", | 971 | "[WEB UTIL]: HTTP OUT {0} took {1}ms", |
962 | reqnum, tickdiff, tickdata); | 972 | reqnum, tickdiff); |
963 | } | 973 | } |
964 | } | 974 | } |
965 | } | 975 | } |
@@ -997,6 +1007,8 @@ namespace OpenSim.Framework | |||
997 | request.Timeout = timeoutsecs * 1000; | 1007 | request.Timeout = timeoutsecs * 1000; |
998 | string respstring = String.Empty; | 1008 | string respstring = String.Empty; |
999 | 1009 | ||
1010 | int tickset = Util.EnvironmentTickCountSubtract(tickstart); | ||
1011 | |||
1000 | using (MemoryStream buffer = new MemoryStream()) | 1012 | using (MemoryStream buffer = new MemoryStream()) |
1001 | { | 1013 | { |
1002 | if ((verb == "POST") || (verb == "PUT")) | 1014 | if ((verb == "POST") || (verb == "PUT")) |
@@ -1079,6 +1091,7 @@ namespace OpenSim.Framework | |||
1079 | verb, | 1091 | verb, |
1080 | requestUrl, | 1092 | requestUrl, |
1081 | tickdiff, | 1093 | tickdiff, |
1094 | tickset, | ||
1082 | tickdata, | 1095 | tickdata, |
1083 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); | 1096 | obj.Length > WebUtil.MaxRequestDiagLength ? obj.Remove(WebUtil.MaxRequestDiagLength) : obj); |
1084 | else if (WebUtil.DebugLevel >= 4) | 1097 | else if (WebUtil.DebugLevel >= 4) |
@@ -1142,6 +1155,8 @@ namespace OpenSim.Framework | |||
1142 | ht.ServicePoint.ConnectionLimit = maxConnections; | 1155 | ht.ServicePoint.ConnectionLimit = maxConnections; |
1143 | 1156 | ||
1144 | request.Method = verb; | 1157 | request.Method = verb; |
1158 | if (pTimeout != 0) | ||
1159 | request.Timeout = pTimeout * 1000; | ||
1145 | MemoryStream buffer = null; | 1160 | MemoryStream buffer = null; |
1146 | 1161 | ||
1147 | if ((verb == "POST") || (verb == "PUT")) | 1162 | if ((verb == "POST") || (verb == "PUT")) |