aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs43
-rw-r--r--OpenSim/Framework/Servers/HttpServer/RestSessionService.cs3
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestObjectRequester.cs2
3 files changed, 31 insertions, 17 deletions
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;
59using System.Text; 59using System.Text;
60using HttpServer; 60using HttpServer;
61using OpenMetaverse; 61using OpenMetaverse;
62using System.Reflection;
63using log4net;
62 64
63namespace OpenSim.Framework.Servers.HttpServer 65namespace OpenSim.Framework.Servers.HttpServer
64{ 66{
@@ -66,6 +68,10 @@ namespace OpenSim.Framework.Servers.HttpServer
66 68
67 public class PollServiceWorkerThread 69 public class PollServiceWorkerThread
68 { 70 {
71 private static readonly ILog m_log =
72 LogManager.GetLogger(
73 MethodBase.GetCurrentMethod().DeclaringType);
74
69 public event ReQueuePollServiceItem ReQueue; 75 public event ReQueuePollServiceItem ReQueue;
70 76
71 private readonly BaseHttpServer m_server; 77 private readonly BaseHttpServer m_server;
@@ -92,31 +98,36 @@ namespace OpenSim.Framework.Servers.HttpServer
92 while (m_running) 98 while (m_running)
93 { 99 {
94 PollServiceHttpRequest req = m_request.Dequeue(); 100 PollServiceHttpRequest req = m_request.Dequeue();
95 if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) 101 try
96 { 102 {
97 StreamReader str = new StreamReader(req.Request.Body); 103 if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id))
98
99 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
100 m_server.DoHTTPGruntWork(responsedata,
101 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
102 }
103 else
104 {
105 if ((Environment.TickCount - req.RequestTime) > m_timeout)
106 { 104 {
107 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), 105 StreamReader str = new StreamReader(req.Request.Body);
106
107 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
108 m_server.DoHTTPGruntWork(responsedata,
108 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); 109 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
109 } 110 }
110 else 111 else
111 { 112 {
112 ReQueuePollServiceItem reQueueItem = ReQueue; 113 if ((Environment.TickCount - req.RequestTime) > m_timeout)
113 if (reQueueItem != null) 114 {
114 reQueueItem(req); 115 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(),
116 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
117 }
118 else
119 {
120 ReQueuePollServiceItem reQueueItem = ReQueue;
121 if (reQueueItem != null)
122 reQueueItem(req);
123 }
115 } 124 }
116 } 125 }
126 catch (Exception e)
127 {
128 m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
129 }
117 } 130 }
118
119
120 } 131 }
121 132
122 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest) 133 internal void Enqueue(PollServiceHttpRequest pPollServiceHttpRequest)
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
75 WebRequest request = WebRequest.Create(requestUrl); 75 WebRequest request = WebRequest.Create(requestUrl);
76 request.Method = verb; 76 request.Method = verb;
77 request.ContentType = "text/xml"; 77 request.ContentType = "text/xml";
78 request.Timeout = 20000;
78 79
79 MemoryStream buffer = new MemoryStream(); 80 MemoryStream buffer = new MemoryStream();
80 81
@@ -98,7 +99,9 @@ namespace OpenSim.Framework.Servers.HttpServer
98 { 99 {
99 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 100 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
100 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 101 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
102 resp.Close();
101 } 103 }
104 requestStream.Close();
102 return deserial; 105 return deserial;
103 } 106 }
104 } 107 }
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
62 WebRequest request = WebRequest.Create(requestUrl); 62 WebRequest request = WebRequest.Create(requestUrl);
63 request.Method = verb; 63 request.Method = verb;
64 64
65 if (verb == "POST") 65 if ((verb == "POST") || (verb == "PUT"))
66 { 66 {
67 request.ContentType = "text/xml"; 67 request.ContentType = "text/xml";
68 68