Fix behaviour change in recent commit bbc1dc6 so that SynchronousRestObjectRequester.MakeRequest() calls with no timeout specified use the default HttpWebRequest timeout as previously.

I mistakenly thought that that default request timeout was inifite rather than 100 seconds, restoring previously behaviour.
As per http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout%28v=vs.100%29.aspx
Relates to http://opensimulator.org/mantis/view.php?id=7165
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-13 22:21:20 +01:00
parent 484aa72ff8
commit 4569c595bf
1 changed files with 10 additions and 5 deletions

View File

@ -36,7 +36,6 @@ using System.Net;
using System.Net.Security;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
@ -1092,7 +1091,7 @@ namespace OpenSim.Framework
/// </returns>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
{
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, Timeout.Infinite);
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 0);
}
/// <summary>
@ -1101,7 +1100,9 @@ namespace OpenSim.Framework
/// <param name="verb"></param>
/// <param name="requestUrl"></param>
/// <param name="obj"></param>
/// <param name="pTimeout">Request timeout in milliseconds. Timeout.Infinite indicates no timeout.</param>
/// <param name="pTimeout">
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
/// </param>
/// <returns>
/// The response. If there was an internal exception or the request timed out,
/// then the default(TResponse) is returned.
@ -1117,7 +1118,9 @@ namespace OpenSim.Framework
/// <param name="verb"></param>
/// <param name="requestUrl"></param>
/// <param name="obj"></param>
/// <param name="pTimeout">Request timeout in milliseconds. Timeout.Infinite indicates no timeout.</param>
/// <param name="pTimeout">
/// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds)
/// </param>
/// <param name="maxConnections"></param>
/// <returns>
/// The response. If there was an internal exception or the request timed out,
@ -1139,6 +1142,8 @@ namespace OpenSim.Framework
WebRequest request = WebRequest.Create(requestUrl);
HttpWebRequest ht = (HttpWebRequest)request;
if (pTimeout != 0)
ht.Timeout = pTimeout;
if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections)