Implement a timeout value in the SynchronousRestObjectRequester. Default is 100 seconds.

avinationmerge
Tom Grimshaw 2010-07-03 06:08:18 -07:00
parent 68281b356c
commit 3d495b709e
1 changed files with 16 additions and 1 deletions

View File

@ -56,6 +56,21 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
{
return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, 100);
}
/// <summary>
/// Perform a synchronous REST request.
/// </summary>
/// <param name="verb"></param>
/// <param name="requestUrl"></param>
/// <param name="obj"> </param>
/// <param name="timeout"> </param>
/// <returns></returns>
///
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout)
{
Type type = typeof (TRequest);
TResponse deserial = default(TResponse);
@ -81,7 +96,7 @@ namespace OpenSim.Framework.Servers.HttpServer
int length = (int) buffer.Length;
request.ContentLength = length;
request.Timeout = pTimeout * 1000;
Stream requestStream = null;
try
{