aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs13
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs87
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs15
4 files changed, 49 insertions, 75 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index e59d475..ce4503c 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -1935,20 +1935,13 @@ namespace OpenSim.Framework.Servers.HttpServer
1935 { 1935 {
1936 response.ProtocolVersion = (string)responsedata["http_protocol_version"]; 1936 response.ProtocolVersion = (string)responsedata["http_protocol_version"];
1937 } 1937 }
1938/* 1938
1939 if (responsedata.ContainsKey("keepalive")) 1939 if (responsedata.ContainsKey("keepalive"))
1940 { 1940 {
1941 bool keepalive = (bool)responsedata["keepalive"]; 1941 bool keepalive = (bool)responsedata["keepalive"];
1942 response.KeepAlive = keepalive; 1942 response.KeepAlive = keepalive;
1943 } 1943 }
1944 1944
1945 if (responsedata.ContainsKey("reusecontext"))
1946 response.ReuseContext = (bool) responsedata["reusecontext"];
1947*/
1948 // disable this things
1949 response.KeepAlive = false;
1950 // response.ReuseContext = false;
1951
1952 // Cross-Origin Resource Sharing with simple requests 1945 // Cross-Origin Resource Sharing with simple requests
1953 if (responsedata.ContainsKey("access_control_allow_origin")) 1946 if (responsedata.ContainsKey("access_control_allow_origin"))
1954 response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]); 1947 response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]);
@@ -1961,11 +1954,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1961 contentType = "text/html"; 1954 contentType = "text/html";
1962 } 1955 }
1963 1956
1964
1965
1966 // The client ignores anything but 200 here for web login, so ensure that this is 200 for that 1957 // The client ignores anything but 200 here for web login, so ensure that this is 200 for that
1967 1958
1968
1969 response.StatusCode = responsecode; 1959 response.StatusCode = responsecode;
1970 1960
1971 if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) 1961 if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently)
@@ -1975,7 +1965,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1975 } 1965 }
1976 1966
1977 response.AddHeader("Content-Type", contentType); 1967 response.AddHeader("Content-Type", contentType);
1978
1979 if (responsedata.ContainsKey("headers")) 1968 if (responsedata.ContainsKey("headers"))
1980 { 1969 {
1981 Hashtable headerdata = (Hashtable)responsedata["headers"]; 1970 Hashtable headerdata = (Hashtable)responsedata["headers"];
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
index 415c264..cbdd781 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
@@ -271,22 +271,17 @@ namespace OpenSim.Framework.Servers.HttpServer
271 271
272 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) 272 if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
273 { 273 {
274 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
275
276 m_threadPool.QueueWorkItem(x => 274 m_threadPool.QueueWorkItem(x =>
277 { 275 {
278 try 276 try
279 { 277 {
278 Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id);
280 req.DoHTTPGruntWork(m_server, responsedata); 279 req.DoHTTPGruntWork(m_server, responsedata);
281 } 280 }
282 catch (ObjectDisposedException) { } 281 catch (ObjectDisposedException) { }
283 finally 282 finally
284 { 283 {
285 if(req.HttpContext.CanSend() && req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Poll 284 byContextDequeue(req);
286 && (Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
287 ReQueueEvent(req);
288 else
289 byContextDequeue(req);
290 } 285 }
291 return null; 286 return null;
292 }, null); 287 }, null);
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
index 51f9049..9ccfd5d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/EventQueue/EventQueueGetModule.cs
@@ -30,7 +30,7 @@ using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Threading; 33using System.Text;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using Mono.Addins; 36using Mono.Addins;
@@ -292,8 +292,6 @@ namespace OpenSim.Region.ClientStack.Linden
292 Queue<OSD> queue; 292 Queue<OSD> queue;
293 Random rnd = new Random(Environment.TickCount); 293 Random rnd = new Random(Environment.TickCount);
294 int nrnd = rnd.Next(30000000); 294 int nrnd = rnd.Next(30000000);
295 if (nrnd < 0)
296 nrnd = -nrnd;
297 295
298 lock (queues) 296 lock (queues)
299 { 297 {
@@ -307,21 +305,11 @@ namespace OpenSim.Region.ClientStack.Linden
307 queue = new Queue<OSD>(); 305 queue = new Queue<OSD>();
308 queues[agentID] = queue; 306 queues[agentID] = queue;
309 307
310 // push markers to handle old responses still waiting
311 // this will cost at most viewer getting two forced noevents
312 // even being a new queue better be safe
313 queue.Enqueue(null);
314 queue.Enqueue(null); // one should be enough
315
316 lock (m_AvatarQueueUUIDMapping) 308 lock (m_AvatarQueueUUIDMapping)
317 { 309 {
318 eventQueueGetUUID = UUID.Random(); 310 eventQueueGetUUID = UUID.Random();
319 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) 311 while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
320 { 312 eventQueueGetUUID = UUID.Random();
321 // oops this should not happen ?
322 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID without a queue");
323 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
324 }
325 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); 313 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
326 } 314 }
327 lock (m_ids) 315 lock (m_ids)
@@ -329,18 +317,14 @@ namespace OpenSim.Region.ClientStack.Linden
329 if (!m_ids.ContainsKey(agentID)) 317 if (!m_ids.ContainsKey(agentID))
330 m_ids.Add(agentID, nrnd); 318 m_ids.Add(agentID, nrnd);
331 else 319 else
332 m_ids[agentID] = nrnd; 320 m_ids[agentID]++;
333 } 321 }
334 } 322 }
335 else 323 else
336 { 324 {
337 // push markers to handle old responses still waiting
338 // this will cost at most viewer getting two forced noevents
339 // even being a new queue better be safe
340 queue.Enqueue(null); 325 queue.Enqueue(null);
341 queue.Enqueue(null); // one should be enough 326 queue.Enqueue(null); // one should be enough
342 327 // reuse or not to reuse
343 // reuse or not to reuse TODO FIX
344 lock (m_AvatarQueueUUIDMapping) 328 lock (m_AvatarQueueUUIDMapping)
345 { 329 {
346 // Reuse open queues. The client does! 330 // Reuse open queues. The client does!
@@ -349,29 +333,38 @@ namespace OpenSim.Region.ClientStack.Linden
349 { 333 {
350 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); 334 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
351 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; 335 eventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
336 lock (m_ids)
337 {
338 // change to negative numbers so they are changed at end of sending first marker
339 // old data on a queue may be sent on a response for a new caps
340 // but at least will be sent with coerent IDs
341 if (!m_ids.ContainsKey(agentID))
342 m_ids.Add(agentID, -nrnd); // should not happen
343 else
344 m_ids[agentID] = -m_ids[agentID];
345 }
352 } 346 }
353 else 347 else
354 { 348 {
355 eventQueueGetUUID = UUID.Random(); 349 eventQueueGetUUID = UUID.Random();
350 while(m_AvatarQueueUUIDMapping.ContainsKey(agentID))
351 eventQueueGetUUID = UUID.Random();
356 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID); 352 m_AvatarQueueUUIDMapping.Add(agentID, eventQueueGetUUID);
357 m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!"); 353 m_log.DebugFormat("[EVENTQUEUE]: Using random UUID!");
354 lock (m_ids)
355 {
356 if (!m_ids.ContainsKey(agentID))
357 m_ids.Add(agentID, nrnd);
358 else
359 m_ids[agentID]++;
360 }
358 } 361 }
359 } 362 }
360 lock (m_ids)
361 {
362 // change to negative numbers so they are changed at end of sending first marker
363 // old data on a queue may be sent on a response for a new caps
364 // but at least will be sent with coerent IDs
365 if (!m_ids.ContainsKey(agentID))
366 m_ids.Add(agentID, -nrnd); // should not happen
367 else
368 m_ids[agentID] = -m_ids[agentID];
369 }
370 } 363 }
371 } 364 }
372 365
373 caps.RegisterPollHandler( 366 caps.RegisterPollHandler(
374 "EventQueueGet", 367 "EventQueueGet",
375 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS)); 368 new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, Drop, agentID, SERVER_EQ_TIME_NO_EVENTS));
376 } 369 }
377 370
@@ -448,7 +441,6 @@ namespace OpenSim.Region.ClientStack.Linden
448 if (DebugLevel > 0) 441 if (DebugLevel > 0)
449 LogOutboundDebugMessage(element, pAgentId); 442 LogOutboundDebugMessage(element, pAgentId);
450 array.Add(element); 443 array.Add(element);
451 thisID++;
452 } 444 }
453 } 445 }
454 446
@@ -465,8 +457,6 @@ namespace OpenSim.Region.ClientStack.Linden
465 { 457 {
466 Random rnd = new Random(Environment.TickCount); 458 Random rnd = new Random(Environment.TickCount);
467 thisID = rnd.Next(30000000); 459 thisID = rnd.Next(30000000);
468 if (thisID < 0)
469 thisID = -thisID;
470 } 460 }
471 461
472 lock (m_ids) 462 lock (m_ids)
@@ -474,16 +464,19 @@ namespace OpenSim.Region.ClientStack.Linden
474 m_ids[pAgentId] = thisID + 1; 464 m_ids[pAgentId] = thisID + 1;
475 } 465 }
476 466
467 Hashtable responsedata;
477 // if there where no elements before a marker send a NoEvents 468 // if there where no elements before a marker send a NoEvents
478 if (array.Count == 0) 469 if (events == null)
479 return NoEvents(requestID, pAgentId); 470 {
480 471 return NoEvents(requestID, pAgentId);
481 Hashtable responsedata = new Hashtable(); 472 }
482 responsedata["int_response_code"] = 200; 473 else
483 responsedata["content_type"] = "application/xml"; 474 {
484 responsedata["keepalive"] = false; 475 responsedata = new Hashtable();
485 responsedata["reusecontext"] = false; 476 responsedata["int_response_code"] = 200;
486 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 477 responsedata["content_type"] = "application/xml";
478 responsedata["bin_response_data"] = Encoding.UTF8.GetBytes(OSDParser.SerializeLLSDXmlString(events));
479 }
487 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]); 480 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
488 return responsedata; 481 return responsedata;
489 } 482 }
@@ -493,13 +486,13 @@ namespace OpenSim.Region.ClientStack.Linden
493 Hashtable responsedata = new Hashtable(); 486 Hashtable responsedata = new Hashtable();
494 responsedata["int_response_code"] = 502; 487 responsedata["int_response_code"] = 502;
495 responsedata["content_type"] = "text/plain"; 488 responsedata["content_type"] = "text/plain";
496 responsedata["keepalive"] = false;
497 responsedata["reusecontext"] = false;
498 responsedata["str_response_string"] = "<llsd></llsd>"; 489 responsedata["str_response_string"] = "<llsd></llsd>";
499 responsedata["error_status_text"] = "<llsd></llsd>"; 490 responsedata["error_status_text"] = "<llsd></llsd>";
500 responsedata["http_protocol_version"] = "HTTP/1.0"; 491 responsedata["http_protocol_version"] = "HTTP/1.0";
492 responsedata["keepalive"] = false;
501 return responsedata; 493 return responsedata;
502 } 494 }
495
503/* this is not a event message 496/* this is not a event message
504 public void DisableSimulator(ulong handle, UUID avatarID) 497 public void DisableSimulator(ulong handle, UUID avatarID)
505 { 498 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index a2c7c83..c7e58e5 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -1719,26 +1719,23 @@ namespace OpenSim.Region.CoreModules.World.Land
1719 1719
1720 private void EventManagerOnRegisterCaps(UUID agentID, Caps caps) 1720 private void EventManagerOnRegisterCaps(UUID agentID, Caps caps)
1721 { 1721 {
1722 //string capsBase = "/CAPS/" + UUID.Random(); 1722 string cap = "/CAPS/" + UUID.Random();
1723 string capsBase = "/CAPS/" + caps.CapsObjectPath;
1724 caps.RegisterHandler( 1723 caps.RegisterHandler(
1725 "RemoteParcelRequest", 1724 "RemoteParcelRequest",
1726 new RestStreamHandler( 1725 new RestStreamHandler(
1727 "POST", 1726 "POST", cap,
1728 capsBase,
1729 (request, path, param, httpRequest, httpResponse) 1727 (request, path, param, httpRequest, httpResponse)
1730 => RemoteParcelRequest(request, path, param, agentID, caps), 1728 => RemoteParcelRequest(request, path, param, agentID, caps),
1731 "RemoteParcelRequest", 1729 "RemoteParcelRequest",
1732 agentID.ToString())); 1730 agentID.ToString()));
1733 1731
1734 UUID parcelCapID = UUID.Random(); 1732 cap = "/CAPS/" + UUID.Random();
1735 caps.RegisterHandler( 1733 caps.RegisterHandler(
1736 "ParcelPropertiesUpdate", 1734 "ParcelPropertiesUpdate",
1737 new RestStreamHandler( 1735 new RestStreamHandler(
1738 "POST", 1736 "POST", cap,
1739 "/CAPS/" + parcelCapID, 1737 (request, path, param, httpRequest, httpResponse)
1740 (request, path, param, httpRequest, httpResponse) 1738 => ProcessPropertiesUpdate(request, path, param, agentID, caps),
1741 => ProcessPropertiesUpdate(request, path, param, agentID, caps),
1742 "ParcelPropertiesUpdate", 1739 "ParcelPropertiesUpdate",
1743 agentID.ToString())); 1740 agentID.ToString()));
1744 } 1741 }