From 33186527235091f95a7251ea66a713fdaee1c689 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 21 Aug 2009 11:00:45 -0700 Subject: Added a more sane InventoryServerMoveItemsHandler. Changed SynchronousRestObjectRequester so that it also understands PUTs. --- OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers/HttpServer') diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs index 09ef95b..ec9bd4f 100644 --- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs @@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; - if (verb == "POST") + if ((verb == "POST") || (verb == "PUT")) { request.ContentType = "text/xml"; -- cgit v1.1 From cfd9cf7b18331a9d2117294f6ba23dd03a9423a1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 25 Aug 2009 06:17:36 -0700 Subject: Closed the web request and stream in SynchronousRestSessionObjectPoster -- maybe this is the cause of some timeouts seen in some monos? --- OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework/Servers/HttpServer') diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index ec2f9ec..2ef4a36 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -75,6 +75,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; request.ContentType = "text/xml"; + request.Timeout = 20000; MemoryStream buffer = new MemoryStream(); @@ -98,7 +99,9 @@ namespace OpenSim.Framework.Servers.HttpServer { XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); + resp.Close(); } + requestStream.Close(); return deserial; } } -- cgit v1.1 From 8a9d1689284a00f27a38ae45535b8b68bf814852 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 26 Aug 2009 14:46:10 +0100 Subject: Add try/catch around EQ request processing Fixes Mantis #4061 --- .../Servers/HttpServer/PollServiceWorkerThread.cs | 43 ++++++++++++++-------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'OpenSim/Framework/Servers/HttpServer') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index d8cbeac..41fb376 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -59,6 +59,8 @@ using System.IO; using System.Text; using HttpServer; using OpenMetaverse; +using System.Reflection; +using log4net; namespace OpenSim.Framework.Servers.HttpServer { @@ -66,6 +68,10 @@ namespace OpenSim.Framework.Servers.HttpServer public class PollServiceWorkerThread { + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + public event ReQueuePollServiceItem ReQueue; private readonly BaseHttpServer m_server; @@ -92,31 +98,36 @@ namespace OpenSim.Framework.Servers.HttpServer while (m_running) { PollServiceHttpRequest req = m_request.Dequeue(); - if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) + try { - StreamReader str = new StreamReader(req.Request.Body); - - Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); - m_server.DoHTTPGruntWork(responsedata, - new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); - } - else - { - if ((Environment.TickCount - req.RequestTime) > m_timeout) + if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) { - m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), + StreamReader str = new StreamReader(req.Request.Body); + + Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); + m_server.DoHTTPGruntWork(responsedata, new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); } else { - ReQueuePollServiceItem reQueueItem = ReQueue; - if (reQueueItem != null) - reQueueItem(req); + if ((Environment.TickCount - req.RequestTime) > m_timeout) + { + m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), + new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); + } + else + { + ReQueuePollServiceItem reQueueItem = ReQueue; + if (reQueueItem != null) + reQueueItem(req); + } } } + catch (Exception e) + { + m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); + } } - - } internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) -- cgit v1.1