diff options
Diffstat (limited to '')
7 files changed, 384 insertions, 36 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index c0dc907..cb47cbf 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -136,7 +136,7 @@ namespace OpenSim.Framework.Servers | |||
136 | { | 136 | { |
137 | m_log.Info("[STARTUP]: Beginning startup processing"); | 137 | m_log.Info("[STARTUP]: Beginning startup processing"); |
138 | 138 | ||
139 | m_log.Info("[STARTUP]: OpenSimulator version: " + m_version + Environment.NewLine); | 139 | m_log.Info("[STARTUP]: Careminster version: " + m_version + Environment.NewLine); |
140 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and | 140 | // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and |
141 | // the clr version number doesn't match the project version number under Mono. | 141 | // the clr version number doesn't match the project version number under Mono. |
142 | //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); | 142 | //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 2cd626f..93043cb 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -334,6 +334,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
334 | StreamReader reader = new StreamReader(requestStream, encoding); | 334 | StreamReader reader = new StreamReader(requestStream, encoding); |
335 | 335 | ||
336 | string requestBody = reader.ReadToEnd(); | 336 | string requestBody = reader.ReadToEnd(); |
337 | reader.Close(); | ||
337 | 338 | ||
338 | Hashtable keysvals = new Hashtable(); | 339 | Hashtable keysvals = new Hashtable(); |
339 | Hashtable headervals = new Hashtable(); | 340 | Hashtable headervals = new Hashtable(); |
@@ -642,7 +643,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
642 | // Every month or so this will wrap and give bad numbers, not really a problem | 643 | // Every month or so this will wrap and give bad numbers, not really a problem |
643 | // since its just for reporting | 644 | // since its just for reporting |
644 | int tickdiff = requestEndTick - requestStartTick; | 645 | int tickdiff = requestEndTick - requestStartTick; |
645 | if (tickdiff > 3000 && requestHandler != null && requestHandler.Name != "GetTexture") | 646 | if (tickdiff > 3000 && (requestHandler == null || requestHandler.Name == null || requestHandler.Name != "GetTexture")) |
646 | { | 647 | { |
647 | m_log.InfoFormat( | 648 | m_log.InfoFormat( |
648 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", | 649 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} {4} from {5} took {6}ms", |
@@ -1476,10 +1477,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1476 | 1477 | ||
1477 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1478 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1478 | { | 1479 | { |
1479 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1480 | int responsecode; |
1480 | int responsecode = (int)responsedata["int_response_code"]; | 1481 | string responseString = String.Empty; |
1481 | string responseString = (string)responsedata["str_response_string"]; | 1482 | byte[] responseData = null; |
1482 | string contentType = (string)responsedata["content_type"]; | 1483 | string contentType; |
1484 | |||
1485 | if (responsedata == null) | ||
1486 | { | ||
1487 | responsecode = 500; | ||
1488 | responseString = "No response could be obtained"; | ||
1489 | contentType = "text/plain"; | ||
1490 | responsedata = new Hashtable(); | ||
1491 | } | ||
1492 | else | ||
1493 | { | ||
1494 | try | ||
1495 | { | ||
1496 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | ||
1497 | responsecode = (int)responsedata["int_response_code"]; | ||
1498 | if (responsedata["bin_response_data"] != null) | ||
1499 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1500 | else | ||
1501 | responseString = (string)responsedata["str_response_string"]; | ||
1502 | contentType = (string)responsedata["content_type"]; | ||
1503 | if (responseString == null) | ||
1504 | responseString = String.Empty; | ||
1505 | } | ||
1506 | catch | ||
1507 | { | ||
1508 | responsecode = 500; | ||
1509 | responseString = "No response could be obtained"; | ||
1510 | contentType = "text/plain"; | ||
1511 | responsedata = new Hashtable(); | ||
1512 | } | ||
1513 | } | ||
1483 | 1514 | ||
1484 | if (responsedata.ContainsKey("error_status_text")) | 1515 | if (responsedata.ContainsKey("error_status_text")) |
1485 | { | 1516 | { |
@@ -1524,25 +1555,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1524 | 1555 | ||
1525 | response.AddHeader("Content-Type", contentType); | 1556 | response.AddHeader("Content-Type", contentType); |
1526 | 1557 | ||
1558 | if (responsedata.ContainsKey("headers")) | ||
1559 | { | ||
1560 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1561 | |||
1562 | foreach (string header in headerdata.Keys) | ||
1563 | response.AddHeader(header, (string)headerdata[header]); | ||
1564 | } | ||
1565 | |||
1527 | byte[] buffer; | 1566 | byte[] buffer; |
1528 | 1567 | ||
1529 | if (!(contentType.Contains("image") | 1568 | if (responseData != null) |
1530 | || contentType.Contains("x-shockwave-flash") | ||
1531 | || contentType.Contains("application/x-oar") | ||
1532 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1533 | { | 1569 | { |
1534 | // Text | 1570 | buffer = responseData; |
1535 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1536 | } | 1571 | } |
1537 | else | 1572 | else |
1538 | { | 1573 | { |
1539 | // Binary! | 1574 | if (!(contentType.Contains("image") |
1540 | buffer = Convert.FromBase64String(responseString); | 1575 | || contentType.Contains("x-shockwave-flash") |
1541 | } | 1576 | || contentType.Contains("application/x-oar") |
1577 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1578 | { | ||
1579 | // Text | ||
1580 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1581 | } | ||
1582 | else | ||
1583 | { | ||
1584 | // Binary! | ||
1585 | buffer = Convert.FromBase64String(responseString); | ||
1586 | } | ||
1542 | 1587 | ||
1543 | response.SendChunked = false; | 1588 | response.SendChunked = false; |
1544 | response.ContentLength64 = buffer.Length; | 1589 | response.ContentLength64 = buffer.Length; |
1545 | response.ContentEncoding = Encoding.UTF8; | 1590 | response.ContentEncoding = Encoding.UTF8; |
1591 | } | ||
1546 | 1592 | ||
1547 | return buffer; | 1593 | return buffer; |
1548 | } | 1594 | } |
@@ -1622,7 +1668,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1622 | m_httpListener2.Start(64); | 1668 | m_httpListener2.Start(64); |
1623 | 1669 | ||
1624 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events | 1670 | // Long Poll Service Manager with 3 worker threads a 25 second timeout for no events |
1625 | m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); | 1671 | // m_PollServiceManager = new PollServiceRequestManager(this, 3, 25000); |
1672 | m_PollServiceManager = new PollServiceRequestManager(this, 4, 25000); | ||
1626 | HTTPDRunning = true; | 1673 | HTTPDRunning = true; |
1627 | 1674 | ||
1628 | //HttpListenerContext context; | 1675 | //HttpListenerContext context; |
@@ -1656,7 +1703,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1656 | 1703 | ||
1657 | public void httpServerException(object source, Exception exception) | 1704 | public void httpServerException(object source, Exception exception) |
1658 | { | 1705 | { |
1659 | m_log.Error(String.Format("[BASE HTTP SERVER]: {0} had an exception: {1} ", source.ToString(), exception.Message), exception); | 1706 | if (source.ToString() == "HttpServer.HttpListener" && exception.ToString().StartsWith("Mono.Security.Protocol.Tls.TlsException")) |
1707 | return; | ||
1708 | m_log.ErrorFormat("[BASE HTTP SERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | ||
1660 | /* | 1709 | /* |
1661 | if (HTTPDRunning)// && NotSocketErrors > 5) | 1710 | if (HTTPDRunning)// && NotSocketErrors > 5) |
1662 | { | 1711 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 3089351..c19ac32 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
34 | public delegate void RequestMethod(UUID requestID, Hashtable request); | 34 | public delegate void RequestMethod(UUID requestID, Hashtable request); |
35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); | 35 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); |
36 | 36 | ||
37 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); | 37 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId); |
38 | 38 | ||
39 | public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); | 39 | public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); |
40 | 40 | ||
@@ -45,17 +45,30 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
45 | public NoEventsMethod NoEvents; | 45 | public NoEventsMethod NoEvents; |
46 | public RequestMethod Request; | 46 | public RequestMethod Request; |
47 | public UUID Id; | 47 | public UUID Id; |
48 | public int TimeOutms; | ||
49 | public EventType Type; | ||
50 | |||
51 | public enum EventType : int | ||
52 | { | ||
53 | Normal = 0, | ||
54 | LslHttp = 1, | ||
55 | Inventory = 2, | ||
56 | Texture = 3, | ||
57 | Mesh = 4 | ||
58 | } | ||
48 | 59 | ||
49 | public PollServiceEventArgs( | 60 | public PollServiceEventArgs( |
50 | RequestMethod pRequest, | 61 | RequestMethod pRequest, |
51 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, | 62 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, |
52 | UUID pId) | 63 | UUID pId, int pTimeOutms) |
53 | { | 64 | { |
54 | Request = pRequest; | 65 | Request = pRequest; |
55 | HasEvents = pHasEvents; | 66 | HasEvents = pHasEvents; |
56 | GetEvents = pGetEvents; | 67 | GetEvents = pGetEvents; |
57 | NoEvents = pNoEvents; | 68 | NoEvents = pNoEvents; |
58 | Id = pId; | 69 | Id = pId; |
70 | TimeOutms = pTimeOutms; | ||
71 | Type = EventType.Normal; | ||
59 | } | 72 | } |
60 | } | 73 | } |
61 | } \ No newline at end of file | 74 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 8d50151..4be8bf4 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -33,15 +33,20 @@ using log4net; | |||
33 | using HttpServer; | 33 | using HttpServer; |
34 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Monitoring; | 35 | using OpenSim.Framework.Monitoring; |
36 | using Amib.Threading; | ||
36 | 37 | ||
38 | |||
39 | /* | ||
37 | namespace OpenSim.Framework.Servers.HttpServer | 40 | namespace OpenSim.Framework.Servers.HttpServer |
38 | { | 41 | { |
42 | |||
39 | public class PollServiceRequestManager | 43 | public class PollServiceRequestManager |
40 | { | 44 | { |
41 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 46 | ||
43 | private readonly BaseHttpServer m_server; | 47 | private readonly BaseHttpServer m_server; |
44 | private static Queue m_requests = Queue.Synchronized(new Queue()); | 48 | private static Queue m_requests = Queue.Synchronized(new Queue()); |
49 | private static ManualResetEvent m_ev = new ManualResetEvent(false); | ||
45 | private uint m_WorkerThreadCount = 0; | 50 | private uint m_WorkerThreadCount = 0; |
46 | private Thread[] m_workerThreads; | 51 | private Thread[] m_workerThreads; |
47 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; | 52 | private PollServiceWorkerThread[] m_PollServiceWorkerThreads; |
@@ -67,7 +72,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
67 | ThreadPriority.Normal, | 72 | ThreadPriority.Normal, |
68 | false, | 73 | false, |
69 | true, | 74 | true, |
70 | null, | ||
71 | int.MaxValue); | 75 | int.MaxValue); |
72 | } | 76 | } |
73 | 77 | ||
@@ -77,7 +81,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
77 | ThreadPriority.Normal, | 81 | ThreadPriority.Normal, |
78 | false, | 82 | false, |
79 | true, | 83 | true, |
80 | null, | ||
81 | 1000 * 60 * 10); | 84 | 1000 * 60 * 10); |
82 | } | 85 | } |
83 | 86 | ||
@@ -91,15 +94,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
91 | { | 94 | { |
92 | lock (m_requests) | 95 | lock (m_requests) |
93 | m_requests.Enqueue(req); | 96 | m_requests.Enqueue(req); |
97 | m_ev.Set(); | ||
94 | } | 98 | } |
95 | 99 | ||
96 | public void ThreadStart() | 100 | public void ThreadStart() |
97 | { | 101 | { |
98 | while (m_running) | 102 | while (m_running) |
99 | { | 103 | { |
104 | m_ev.WaitOne(1000); | ||
105 | m_ev.Reset(); | ||
100 | Watchdog.UpdateThread(); | 106 | Watchdog.UpdateThread(); |
101 | ProcessQueuedRequests(); | 107 | ProcessQueuedRequests(); |
102 | Thread.Sleep(1000); | ||
103 | } | 108 | } |
104 | } | 109 | } |
105 | 110 | ||
@@ -141,8 +146,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
141 | foreach (object o in m_requests) | 146 | foreach (object o in m_requests) |
142 | { | 147 | { |
143 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | 148 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; |
144 | PollServiceWorkerThread.DoHTTPGruntWork( | 149 | m_server.DoHTTPGruntWork( |
145 | m_server, req, req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | 150 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), |
151 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | ||
146 | } | 152 | } |
147 | 153 | ||
148 | m_requests.Clear(); | 154 | m_requests.Clear(); |
@@ -151,8 +157,274 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
151 | { | 157 | { |
152 | t.Abort(); | 158 | t.Abort(); |
153 | } | 159 | } |
154 | |||
155 | m_running = false; | 160 | m_running = false; |
156 | } | 161 | } |
157 | } | 162 | } |
158 | } \ No newline at end of file | 163 | } |
164 | */ | ||
165 | |||
166 | using System.IO; | ||
167 | using System.Text; | ||
168 | using System.Collections.Generic; | ||
169 | |||
170 | namespace OpenSim.Framework.Servers.HttpServer | ||
171 | { | ||
172 | public class PollServiceRequestManager | ||
173 | { | ||
174 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
175 | |||
176 | private readonly BaseHttpServer m_server; | ||
177 | |||
178 | private BlockingQueue<PollServiceHttpRequest> m_requests = new BlockingQueue<PollServiceHttpRequest>(); | ||
179 | private static Queue<PollServiceHttpRequest> m_slowRequests = new Queue<PollServiceHttpRequest>(); | ||
180 | private static Queue<PollServiceHttpRequest> m_retryRequests = new Queue<PollServiceHttpRequest>(); | ||
181 | |||
182 | private uint m_WorkerThreadCount = 0; | ||
183 | private Thread[] m_workerThreads; | ||
184 | private Thread m_retrysThread; | ||
185 | |||
186 | private bool m_running = true; | ||
187 | private int slowCount = 0; | ||
188 | |||
189 | private SmartThreadPool m_threadPool = new SmartThreadPool(20000, 12, 2); | ||
190 | |||
191 | // private int m_timeout = 1000; // increase timeout 250; now use the event one | ||
192 | |||
193 | public PollServiceRequestManager(BaseHttpServer pSrv, uint pWorkerThreadCount, int pTimeout) | ||
194 | { | ||
195 | m_server = pSrv; | ||
196 | m_WorkerThreadCount = pWorkerThreadCount; | ||
197 | m_workerThreads = new Thread[m_WorkerThreadCount]; | ||
198 | |||
199 | //startup worker threads | ||
200 | for (uint i = 0; i < m_WorkerThreadCount; i++) | ||
201 | { | ||
202 | m_workerThreads[i] | ||
203 | = Watchdog.StartThread( | ||
204 | PoolWorkerJob, | ||
205 | String.Format("PollServiceWorkerThread{0}", i), | ||
206 | ThreadPriority.Normal, | ||
207 | false, | ||
208 | false, | ||
209 | null, | ||
210 | int.MaxValue); | ||
211 | } | ||
212 | |||
213 | m_retrysThread = Watchdog.StartThread( | ||
214 | this.CheckRetries, | ||
215 | "PollServiceWatcherThread", | ||
216 | ThreadPriority.Normal, | ||
217 | false, | ||
218 | true, | ||
219 | null, | ||
220 | 1000 * 60 * 10); | ||
221 | } | ||
222 | |||
223 | |||
224 | private void ReQueueEvent(PollServiceHttpRequest req) | ||
225 | { | ||
226 | if (m_running) | ||
227 | { | ||
228 | lock (m_retryRequests) | ||
229 | m_retryRequests.Enqueue(req); | ||
230 | } | ||
231 | } | ||
232 | |||
233 | public void Enqueue(PollServiceHttpRequest req) | ||
234 | { | ||
235 | if (m_running) | ||
236 | { | ||
237 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) | ||
238 | { | ||
239 | m_requests.Enqueue(req); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | lock (m_slowRequests) | ||
244 | m_slowRequests.Enqueue(req); | ||
245 | } | ||
246 | } | ||
247 | } | ||
248 | |||
249 | private void CheckRetries() | ||
250 | { | ||
251 | while (m_running) | ||
252 | { | ||
253 | Thread.Sleep(100); // let the world move .. back to faster rate | ||
254 | Watchdog.UpdateThread(); | ||
255 | lock (m_retryRequests) | ||
256 | { | ||
257 | while (m_retryRequests.Count > 0 && m_running) | ||
258 | m_requests.Enqueue(m_retryRequests.Dequeue()); | ||
259 | } | ||
260 | slowCount++; | ||
261 | if (slowCount >= 10) | ||
262 | { | ||
263 | slowCount = 0; | ||
264 | |||
265 | lock (m_slowRequests) | ||
266 | { | ||
267 | while (m_slowRequests.Count > 0 && m_running) | ||
268 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
269 | } | ||
270 | } | ||
271 | } | ||
272 | } | ||
273 | |||
274 | ~PollServiceRequestManager() | ||
275 | { | ||
276 | m_running = false; | ||
277 | // m_timeout = -10000; // cause all to expire | ||
278 | Thread.Sleep(1000); // let the world move | ||
279 | |||
280 | foreach (Thread t in m_workerThreads) | ||
281 | Watchdog.AbortThread(t.ManagedThreadId); | ||
282 | |||
283 | try | ||
284 | { | ||
285 | foreach (PollServiceHttpRequest req in m_retryRequests) | ||
286 | { | ||
287 | DoHTTPGruntWork(m_server,req, | ||
288 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
289 | } | ||
290 | } | ||
291 | catch | ||
292 | { | ||
293 | } | ||
294 | |||
295 | PollServiceHttpRequest wreq; | ||
296 | m_retryRequests.Clear(); | ||
297 | |||
298 | lock (m_slowRequests) | ||
299 | { | ||
300 | while (m_slowRequests.Count > 0 && m_running) | ||
301 | m_requests.Enqueue(m_slowRequests.Dequeue()); | ||
302 | } | ||
303 | |||
304 | while (m_requests.Count() > 0) | ||
305 | { | ||
306 | try | ||
307 | { | ||
308 | wreq = m_requests.Dequeue(0); | ||
309 | DoHTTPGruntWork(m_server,wreq, | ||
310 | wreq.PollServiceArgs.NoEvents(wreq.RequestID, wreq.PollServiceArgs.Id)); | ||
311 | } | ||
312 | catch | ||
313 | { | ||
314 | } | ||
315 | } | ||
316 | |||
317 | m_requests.Clear(); | ||
318 | } | ||
319 | |||
320 | // work threads | ||
321 | |||
322 | private void PoolWorkerJob() | ||
323 | { | ||
324 | while (m_running) | ||
325 | { | ||
326 | PollServiceHttpRequest req = m_requests.Dequeue(5000); | ||
327 | |||
328 | Watchdog.UpdateThread(); | ||
329 | if (req != null) | ||
330 | { | ||
331 | try | ||
332 | { | ||
333 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) | ||
334 | { | ||
335 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id); | ||
336 | |||
337 | if (responsedata == null) | ||
338 | continue; | ||
339 | |||
340 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Normal) | ||
341 | { | ||
342 | try | ||
343 | { | ||
344 | DoHTTPGruntWork(m_server, req, responsedata); | ||
345 | } | ||
346 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
347 | { | ||
348 | // Ignore it, no need to reply | ||
349 | } | ||
350 | } | ||
351 | else | ||
352 | { | ||
353 | m_threadPool.QueueWorkItem(x => | ||
354 | { | ||
355 | try | ||
356 | { | ||
357 | DoHTTPGruntWork(m_server, req, responsedata); | ||
358 | } | ||
359 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
360 | { | ||
361 | // Ignore it, no need to reply | ||
362 | } | ||
363 | |||
364 | return null; | ||
365 | }, null); | ||
366 | } | ||
367 | } | ||
368 | else | ||
369 | { | ||
370 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | ||
371 | { | ||
372 | DoHTTPGruntWork(m_server, req, | ||
373 | req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id)); | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | ReQueueEvent(req); | ||
378 | } | ||
379 | } | ||
380 | } | ||
381 | catch (Exception e) | ||
382 | { | ||
383 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | } | ||
388 | |||
389 | // DoHTTPGruntWork changed, not sending response | ||
390 | // do the same work around as core | ||
391 | |||
392 | internal static void DoHTTPGruntWork(BaseHttpServer server, PollServiceHttpRequest req, Hashtable responsedata) | ||
393 | { | ||
394 | OSHttpResponse response | ||
395 | = new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext); | ||
396 | |||
397 | byte[] buffer = server.DoHTTPGruntWork(responsedata, response); | ||
398 | |||
399 | response.SendChunked = false; | ||
400 | response.ContentLength64 = buffer.Length; | ||
401 | response.ContentEncoding = Encoding.UTF8; | ||
402 | |||
403 | try | ||
404 | { | ||
405 | response.OutputStream.Write(buffer, 0, buffer.Length); | ||
406 | } | ||
407 | catch (Exception ex) | ||
408 | { | ||
409 | m_log.Warn(string.Format("[POLL SERVICE WORKER THREAD]: Error ", ex)); | ||
410 | } | ||
411 | finally | ||
412 | { | ||
413 | //response.OutputStream.Close(); | ||
414 | try | ||
415 | { | ||
416 | response.OutputStream.Flush(); | ||
417 | response.Send(); | ||
418 | |||
419 | //if (!response.KeepAlive && response.ReuseContext) | ||
420 | // response.FreeContext(); | ||
421 | } | ||
422 | catch (Exception e) | ||
423 | { | ||
424 | m_log.Warn(String.Format("[POLL SERVICE WORKER THREAD]: Error ", e)); | ||
425 | } | ||
426 | } | ||
427 | } | ||
428 | } | ||
429 | } | ||
430 | |||
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 5adbcd1..1c529b6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -25,6 +25,8 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* Ubit work moved to PollServiceRequestManager | ||
29 | |||
28 | using System; | 30 | using System; |
29 | using System.Collections; | 31 | using System.Collections; |
30 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
@@ -90,8 +92,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
90 | continue; | 92 | continue; |
91 | } | 93 | } |
92 | 94 | ||
93 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | 95 | try |
94 | DoHTTPGruntWork(m_server, req, responsedata); | 96 | { |
97 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); | ||
98 | DoHTTPGruntWork(m_server, req, responsedata); | ||
99 | } | ||
100 | catch (ObjectDisposedException) // Browser aborted before we could read body, server closed the stream | ||
101 | { | ||
102 | // Ignore it, no need to reply | ||
103 | } | ||
95 | } | 104 | } |
96 | else | 105 | else |
97 | { | 106 | { |
@@ -162,4 +171,5 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
162 | } | 171 | } |
163 | } | 172 | } |
164 | } | 173 | } |
165 | } \ No newline at end of file | 174 | } |
175 | */ \ No newline at end of file | ||
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs index 3412e0f..50f306e 100644 --- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs +++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs | |||
@@ -76,6 +76,10 @@ namespace OpenSim.Framework.Servers.Tests | |||
76 | /// </summary> | 76 | /// </summary> |
77 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; | 77 | public event EventHandler<RequestEventArgs> RequestReceived = delegate { }; |
78 | 78 | ||
79 | public bool CanSend { get { return true; } } | ||
80 | public string RemoteEndPoint { get { return ""; } } | ||
81 | public string RemoteEndPointAddress { get { return ""; } } | ||
82 | public string RemoteEndPointPort { get { return ""; } } | ||
79 | } | 83 | } |
80 | 84 | ||
81 | public class TestHttpRequest: IHttpRequest | 85 | public class TestHttpRequest: IHttpRequest |
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index c9d9770..bb094ed 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,11 +29,11 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.7.5"; | 32 | private const string VERSION_NUMBER = "0.7.5CM"; |
33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; | 33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; |
34 | 34 | ||
35 | public enum Flavour | 35 | public enum Flavour |
36 | { | 36 | { |
37 | Unknown, | 37 | Unknown, |
38 | Dev, | 38 | Dev, |
39 | RC1, | 39 | RC1, |
@@ -50,7 +50,7 @@ namespace OpenSim | |||
50 | 50 | ||
51 | public static string GetVersionString(string versionNumber, Flavour flavour) | 51 | public static string GetVersionString(string versionNumber, Flavour flavour) |
52 | { | 52 | { |
53 | string versionString = "OpenSim " + versionNumber + " " + flavour; | 53 | string versionString = "Careminster " + versionNumber + " " + flavour; |
54 | return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); | 54 | return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); |
55 | } | 55 | } |
56 | 56 | ||