aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/HttpServer
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs13
-rw-r--r--OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs13
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs6
4 files changed, 29 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 369d7d4..f2a1da0 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -274,7 +274,7 @@ namespace OpenSim.Framework.Servers.HttpServer
274 public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) 274 public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request)
275 { 275 {
276 OSHttpRequest req = new OSHttpRequest(context, request); 276 OSHttpRequest req = new OSHttpRequest(context, request);
277 OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request)); 277 OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
278 //resp.KeepAlive = req.KeepAlive; 278 //resp.KeepAlive = req.KeepAlive;
279 //m_log.Info("[Debug BASE HTTP SERVER]: Got Request"); 279 //m_log.Info("[Debug BASE HTTP SERVER]: Got Request");
280 //HttpServerContextObj objstate= new HttpServerContextObj(req,resp); 280 //HttpServerContextObj objstate= new HttpServerContextObj(req,resp);
@@ -444,6 +444,7 @@ namespace OpenSim.Framework.Servers.HttpServer
444 try 444 try
445 { 445 {
446 response.Send(); 446 response.Send();
447 response.FreeContext();
447 } 448 }
448 catch (SocketException e) 449 catch (SocketException e)
449 { 450 {
@@ -746,6 +747,7 @@ namespace OpenSim.Framework.Servers.HttpServer
746 try 747 try
747 { 748 {
748 response.Send(); 749 response.Send();
750 response.FreeContext();
749 } 751 }
750 catch (SocketException e) 752 catch (SocketException e)
751 { 753 {
@@ -778,6 +780,7 @@ namespace OpenSim.Framework.Servers.HttpServer
778 try 780 try
779 { 781 {
780 response.Send(); 782 response.Send();
783 response.FreeContext();
781 } 784 }
782 catch (SocketException e) 785 catch (SocketException e)
783 { 786 {
@@ -888,6 +891,7 @@ namespace OpenSim.Framework.Servers.HttpServer
888 { 891 {
889 response.Send(); 892 response.Send();
890 response.OutputStream.Flush(); 893 response.OutputStream.Flush();
894 response.FreeContext();
891 //response.OutputStream.Close(); 895 //response.OutputStream.Close();
892 } 896 }
893 catch (IOException e) 897 catch (IOException e)
@@ -1103,6 +1107,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1103 try 1107 try
1104 { 1108 {
1105 response.Send(); 1109 response.Send();
1110 response.FreeContext();
1106 } 1111 }
1107 catch (SocketException f) 1112 catch (SocketException f)
1108 { 1113 {
@@ -1377,7 +1382,11 @@ namespace OpenSim.Framework.Servers.HttpServer
1377 //response.OutputStream.Close(); 1382 //response.OutputStream.Close();
1378 try 1383 try
1379 { 1384 {
1385 response.OutputStream.Flush();
1380 response.Send(); 1386 response.Send();
1387
1388 if (!response.KeepAlive)
1389 response.FreeContext();
1381 } 1390 }
1382 catch (SocketException e) 1391 catch (SocketException e)
1383 { 1392 {
@@ -1414,6 +1423,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1414 try 1423 try
1415 { 1424 {
1416 response.Send(); 1425 response.Send();
1426 response.FreeContext();
1417 } 1427 }
1418 catch (SocketException e) 1428 catch (SocketException e)
1419 { 1429 {
@@ -1449,6 +1459,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1449 try 1459 try
1450 { 1460 {
1451 response.Send(); 1461 response.Send();
1462 response.FreeContext();
1452 } 1463 }
1453 catch (SocketException e) 1464 catch (SocketException e)
1454 { 1465 {
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs
index d299001..6c90a92 100644
--- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs
+++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs
@@ -258,6 +258,7 @@ namespace OpenSim.Framework.Servers.HttpServer
258 258
259 259
260 protected IHttpResponse _httpResponse; 260 protected IHttpResponse _httpResponse;
261 private IHttpClientContext _httpClientContext;
261 262
262 public OSHttpResponse() {} 263 public OSHttpResponse() {}
263 264
@@ -275,6 +276,12 @@ namespace OpenSim.Framework.Servers.HttpServer
275 public OSHttpResponse(OSHttpRequest req) 276 public OSHttpResponse(OSHttpRequest req)
276 { 277 {
277 _httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest); 278 _httpResponse = new HttpResponse(req.IHttpClientContext, req.IHttpRequest);
279 _httpClientContext = req.IHttpClientContext;
280 }
281 public OSHttpResponse(HttpResponse resp, IHttpClientContext clientContext)
282 {
283 _httpResponse = resp;
284 _httpClientContext = clientContext;
278 } 285 }
279 286
280 /// <summary> 287 /// <summary>
@@ -298,5 +305,11 @@ namespace OpenSim.Framework.Servers.HttpServer
298 _httpResponse.Send(); 305 _httpResponse.Send();
299 306
300 } 307 }
308 public void FreeContext()
309 {
310 if (_httpClientContext != null)
311 _httpClientContext.Close();
312 }
313
301 } 314 }
302} 315}
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 7f632cf..a9ee217 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -130,7 +130,7 @@ namespace OpenSim.Framework.Servers.HttpServer
130 foreach (object o in m_requests) 130 foreach (object o in m_requests)
131 { 131 {
132 PollServiceHttpRequest req = (PollServiceHttpRequest) o; 132 PollServiceHttpRequest req = (PollServiceHttpRequest) o;
133 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); 133 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
134 } 134 }
135 135
136 m_requests.Clear(); 136 m_requests.Clear();
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
index 4c0be78..24205eb 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers.HttpServer
44 private readonly BaseHttpServer m_server; 44 private readonly BaseHttpServer m_server;
45 private BlockingQueue<PollServiceHttpRequest> m_request; 45 private BlockingQueue<PollServiceHttpRequest> m_request;
46 private bool m_running = true; 46 private bool m_running = true;
47 private int m_timeout = 25000; 47 private int m_timeout = 250;
48 48
49 49
50 50
@@ -71,14 +71,14 @@ namespace OpenSim.Framework.Servers.HttpServer
71 71
72 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); 72 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
73 m_server.DoHTTPGruntWork(responsedata, 73 m_server.DoHTTPGruntWork(responsedata,
74 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); 74 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
75 } 75 }
76 else 76 else
77 { 77 {
78 if ((Environment.TickCount - req.RequestTime) > m_timeout) 78 if ((Environment.TickCount - req.RequestTime) > m_timeout)
79 { 79 {
80 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), 80 m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(),
81 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request))); 81 new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
82 } 82 }
83 else 83 else
84 { 84 {