aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-10-03 09:53:49 +0000
committerTeravus Ovares2008-10-03 09:53:49 +0000
commit8de395d379ba3278b2160b66dd8da7f973a2cf10 (patch)
tree58d3f43d7ef9d9d6a48c189cd7d607e54dcbcded /OpenSim/Region
parentReintroduces the discovery mechanism to use llRequestSimulatorData("", 128) (diff)
downloadopensim-SC_OLD-8de395d379ba3278b2160b66dd8da7f973a2cf10.zip
opensim-SC_OLD-8de395d379ba3278b2160b66dd8da7f973a2cf10.tar.gz
opensim-SC_OLD-8de395d379ba3278b2160b66dd8da7f973a2cf10.tar.bz2
opensim-SC_OLD-8de395d379ba3278b2160b66dd8da7f973a2cf10.tar.xz
* EventQueueGet is now working.
* Switched it on by default * Updated OpenSim.ini.example to reflect this * Caught a UDP Server issue that occurs when the network pipe is saturated * Still experimental :D
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs9
-rw-r--r--OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs156
-rw-r--r--OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs7
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs15
4 files changed, 170 insertions, 17 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index f56c0bf..c20c7bc 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -449,7 +449,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
449 else 449 else
450 { 450 {
451 //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString()); 451 //MainLog.Instance.Verbose("UDPSERVER", "SendPacketTo : client " + sendto.ToString());
452 m_socket.SendTo(buffer, size, flags, sendto); 452 try
453 {
454 m_socket.SendTo(buffer, size, flags, sendto);
455 }
456 catch (SocketException SockE)
457 {
458 m_log.ErrorFormat("[UDPSERVER]: Caught Socket Error in the send buffer!. {0}",SockE.ToString());
459 }
453 } 460 }
454 } 461 }
455 } 462 }
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
index 1726ea2..2eb1618 100644
--- a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
+++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs
@@ -90,7 +90,8 @@ namespace OpenSim.Region.Environment.Modules.Framework
90 90
91 // Register fallback handler 91 // Register fallback handler
92 // Why does EQG Fail on region crossings! 92 // Why does EQG Fail on region crossings!
93 scene.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); 93
94 //scene.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack);
94 95
95 scene.EventManager.OnNewClient += OnNewClient; 96 scene.EventManager.OnNewClient += OnNewClient;
96 scene.EventManager.OnClientClosed += ClientClosed; 97 scene.EventManager.OnClientClosed += ClientClosed;
@@ -109,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
109 110
110 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) 111 private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p)
111 { 112 {
112 enabledYN = startupConfig.GetBoolean("EventQueue", false); 113 enabledYN = startupConfig.GetBoolean("EventQueue", true);
113 } 114 }
114 115
115 public void PostInitialise() 116 public void PostInitialise()
@@ -166,6 +167,44 @@ namespace OpenSim.Region.Environment.Modules.Framework
166 private void ClientClosed(UUID AgentID) 167 private void ClientClosed(UUID AgentID)
167 { 168 {
168 queues.Remove(AgentID); 169 queues.Remove(AgentID);
170 List<UUID> removeitems = new List<UUID>();
171 lock (m_AvatarQueueUUIDMapping)
172 {
173 foreach (UUID ky in m_AvatarQueueUUIDMapping.Keys)
174 {
175 if (ky == AgentID)
176 {
177 removeitems.Add(ky);
178 }
179 }
180
181 foreach (UUID ky in removeitems)
182 {
183 m_AvatarQueueUUIDMapping.Remove(ky);
184 m_scene.RemoveHTTPHandler("","/CAPS/EQG/" + ky.ToString() + "/");
185 }
186
187 }
188 UUID searchval = UUID.Zero;
189
190 removeitems.Clear();
191
192 lock (m_QueueUUIDAvatarMapping)
193 {
194 foreach (UUID ky in m_QueueUUIDAvatarMapping.Keys)
195 {
196 searchval = m_QueueUUIDAvatarMapping[ky];
197
198 if (searchval == AgentID)
199 {
200 removeitems.Add(ky);
201 }
202 }
203
204 foreach (UUID ky in removeitems)
205 m_QueueUUIDAvatarMapping.Remove(ky);
206
207 }
169 m_log.DebugFormat("[EVENTQUEUE]: Client {0} deregistered in region {1}.", AgentID, m_scene.RegionInfo.RegionName); 208 m_log.DebugFormat("[EVENTQUEUE]: Client {0} deregistered in region {1}.", AgentID, m_scene.RegionInfo.RegionName);
170 } 209 }
171 210
@@ -177,15 +216,15 @@ namespace OpenSim.Region.Environment.Modules.Framework
177 216
178 private void MakeChildAgent(ScenePresence avatar) 217 private void MakeChildAgent(ScenePresence avatar)
179 { 218 {
180 m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0} in region {1}.", avatar.UUID, m_scene.RegionInfo.RegionName); 219 //m_log.DebugFormat("[EVENTQUEUE]: Make Child agent {0} in region {1}.", avatar.UUID, m_scene.RegionInfo.RegionName);
181 lock (m_ids) 220 //lock (m_ids)
182 { 221 // {
183 if (m_ids.ContainsKey(avatar.UUID)) 222 //if (m_ids.ContainsKey(avatar.UUID))
184 { 223 //{
185 // close the event queue. 224 // close the event queue.
186 //m_ids[avatar.UUID] = -1; 225 //m_ids[avatar.UUID] = -1;
187 } 226 //}
188 } 227 //}
189 } 228 }
190 229
191 public void OnRegisterCaps(UUID agentID, Caps caps) 230 public void OnRegisterCaps(UUID agentID, Caps caps)
@@ -222,12 +261,18 @@ namespace OpenSim.Region.Environment.Modules.Framework
222 } 261 }
223 262
224 m_log.DebugFormat("[EVENTQUEUE]: CAPS URL: {0}", capsBase + EventQueueGetUUID.ToString() + "/"); 263 m_log.DebugFormat("[EVENTQUEUE]: CAPS URL: {0}", capsBase + EventQueueGetUUID.ToString() + "/");
264 // Register this as a caps handler
225 caps.RegisterHandler("EventQueueGet", 265 caps.RegisterHandler("EventQueueGet",
226 new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString(), 266 new RestHTTPHandler("POST", capsBase + EventQueueGetUUID.ToString() + "/",
227 delegate(Hashtable m_dhttpMethod) 267 delegate(Hashtable m_dhttpMethod)
228 { 268 {
229 return ProcessQueue(m_dhttpMethod,agentID, caps); 269 return ProcessQueue(m_dhttpMethod,agentID, caps);
230 })); 270 }));
271
272 bool boolval = false;
273 // This will persist this beyond the expiry of the caps handlers
274 boolval = m_scene.AddHTTPHandler(capsBase + EventQueueGetUUID.ToString() + "/", EventQueuePath2);
275
231 Random rnd = new Random(System.Environment.TickCount); 276 Random rnd = new Random(System.Environment.TickCount);
232 lock (m_ids) 277 lock (m_ids)
233 { 278 {
@@ -262,6 +307,14 @@ namespace OpenSim.Region.Environment.Modules.Framework
262 307
263 if (element == null) 308 if (element == null)
264 { 309 {
310 if (thisID == -1) // close-request
311 {
312 responsedata["int_response_code"] = 404;
313 responsedata["content_type"] = "text/plain";
314 responsedata["keepalive"] = false;
315 responsedata["str_response_string"] = "";
316 return responsedata;
317 }
265 responsedata["int_response_code"] = 502; 318 responsedata["int_response_code"] = 502;
266 responsedata["content_type"] = "text/plain"; 319 responsedata["content_type"] = "text/plain";
267 responsedata["keepalive"] = false; 320 responsedata["keepalive"] = false;
@@ -272,6 +325,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
272 } 325 }
273 326
274 327
328
275 LLSDArray array = new LLSDArray(); 329 LLSDArray array = new LLSDArray();
276 if (element == null) // didn't have an event in 15s 330 if (element == null) // didn't have an event in 15s
277 { 331 {
@@ -306,6 +360,59 @@ namespace OpenSim.Region.Environment.Modules.Framework
306 360
307 return responsedata; 361 return responsedata;
308 } 362 }
363
364 public Hashtable EventQueuePath2(Hashtable request)
365 {
366 string capuuid = (string)request["uri"]; //path.Replace("/CAPS/EQG/","");
367 // pull off the last "/" in the path.
368 Hashtable responsedata = new Hashtable();
369 capuuid = capuuid.Substring(0, capuuid.Length - 1);
370 capuuid = capuuid.Replace("/CAPS/EQG/", "");
371 UUID AvatarID = UUID.Zero;
372 UUID capUUID = UUID.Zero;
373
374 // parse the path and search for the avatar with it registered
375 if (UUID.TryParse(capuuid, out capUUID))
376 {
377 lock (m_QueueUUIDAvatarMapping)
378 {
379 if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID))
380 {
381 AvatarID = m_QueueUUIDAvatarMapping[capUUID];
382 }
383 }
384 if (AvatarID != UUID.Zero)
385 {
386 // m_scene.GetCapsHandlerForUser will return null if the agent doesn't have a caps handler
387 // registered
388 return ProcessQueue(request, AvatarID, m_scene.GetCapsHandlerForUser(AvatarID));
389 }
390 else
391 {
392 responsedata["int_response_code"] = 404;
393 responsedata["content_type"] = "text/plain";
394 responsedata["keepalive"] = false;
395 responsedata["str_response_string"] = "Not Found";
396 responsedata["error_status_text"] = "Not Found";
397 responsedata["http_protocol_version"] = "HTTP/1.0";
398 return responsedata;
399 // return 404
400 }
401 }
402 else
403 {
404 responsedata["int_response_code"] = 404;
405 responsedata["content_type"] = "text/plain";
406 responsedata["keepalive"] = false;
407 responsedata["str_response_string"] = "Not Found";
408 responsedata["error_status_text"] = "Not Found";
409 responsedata["http_protocol_version"] = "HTTP/1.0";
410 return responsedata;
411 // return 404
412 }
413
414 }
415
309 public LLSD EventQueueFallBack(string path, LLSD request, string endpoint) 416 public LLSD EventQueueFallBack(string path, LLSD request, string endpoint)
310 { 417 {
311 // This is a fallback element to keep the client from loosing EventQueueGet 418 // This is a fallback element to keep the client from loosing EventQueueGet
@@ -318,7 +425,9 @@ namespace OpenSim.Region.Environment.Modules.Framework
318 UUID capUUID = UUID.Zero; 425 UUID capUUID = UUID.Zero;
319 if (UUID.TryParse(capuuid, out capUUID)) 426 if (UUID.TryParse(capuuid, out capUUID))
320 { 427 {
321 428/* Don't remove this yet code cleaners!
429 * Still testing this!
430 *
322 lock (m_QueueUUIDAvatarMapping) 431 lock (m_QueueUUIDAvatarMapping)
323 { 432 {
324 if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID)) 433 if (m_QueueUUIDAvatarMapping.ContainsKey(capUUID))
@@ -326,8 +435,28 @@ namespace OpenSim.Region.Environment.Modules.Framework
326 AvatarID = m_QueueUUIDAvatarMapping[capUUID]; 435 AvatarID = m_QueueUUIDAvatarMapping[capUUID];
327 } 436 }
328 } 437 }
438
439
329 if (AvatarID != UUID.Zero) 440 if (AvatarID != UUID.Zero)
330 { 441 {
442 // Repair the CAP!
443 //OpenSim.Framework.Communications.Capabilities.Caps caps = m_scene.GetCapsHandlerForUser(AvatarID);
444 //string capsBase = "/CAPS/EQG/";
445 //caps.RegisterHandler("EventQueueGet",
446 //new RestHTTPHandler("POST", capsBase + capUUID.ToString() + "/",
447 //delegate(Hashtable m_dhttpMethod)
448 //{
449 // return ProcessQueue(m_dhttpMethod, AvatarID, caps);
450 //}));
451 // start new ID sequence.
452 Random rnd = new Random(System.Environment.TickCount);
453 lock (m_ids)
454 {
455 if (!m_ids.ContainsKey(AvatarID))
456 m_ids.Add(AvatarID, rnd.Next(30000000));
457 }
458
459
331 int thisID = 0; 460 int thisID = 0;
332 lock (m_ids) 461 lock (m_ids)
333 thisID = m_ids[AvatarID]; 462 thisID = m_ids[AvatarID];
@@ -365,11 +494,14 @@ namespace OpenSim.Region.Environment.Modules.Framework
365 { 494 {
366 return new LLSD(); 495 return new LLSD();
367 } 496 }
497*
498*/
368 } 499 }
369 else 500 else
370 { 501 {
371 return new LLSD(); 502 //return new LLSD();
372 } 503 }
504 return new LLSDString("shutdown404!");
373 } 505 }
374 } 506 }
375} 507}
diff --git a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
index 9a522ff..1a15585 100644
--- a/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/WorldMap/MapSearchModule.cs
@@ -83,7 +83,12 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
83 // TODO currently, this only returns one region per name. LL servers will return all starting with the provided name. 83 // TODO currently, this only returns one region per name. LL servers will return all starting with the provided name.
84 RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName); 84 RegionInfo info = m_scene.SceneGridService.RequestClosestRegion(mapName);
85 // fetch the mapblock of the named sim. We need this anyway (we have the map open, and just jumped to the sim), 85 // fetch the mapblock of the named sim. We need this anyway (we have the map open, and just jumped to the sim),
86 // so there shouldn't be any penalty for that. 86 // so there shouldn't be any penalty for that.
87 if (info == null)
88 {
89 m_log.Warn("[MAPSEARCHMODULE]: Got Null Region Question!");
90 return;
91 }
87 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)info.RegionLocX, 92 List<MapBlockData> mapBlocks = m_scene.SceneGridService.RequestNeighbourMapBlocks((int)info.RegionLocX,
88 (int)info.RegionLocY, 93 (int)info.RegionLocY,
89 (int)info.RegionLocX, 94 (int)info.RegionLocX,
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 3f3a68d..c33c777 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -608,6 +608,8 @@ namespace OpenSim.Region.Environment.Scenes
608 { 608 {
609 bool destRegionUp = false; 609 bool destRegionUp = false;
610 610
611 IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>();
612
611 if (regionHandle == m_regionInfo.RegionHandle) 613 if (regionHandle == m_regionInfo.RegionHandle)
612 { 614 {
613 // Teleport within the same region 615 // Teleport within the same region
@@ -628,7 +630,12 @@ namespace OpenSim.Region.Environment.Scenes
628 { 630 {
629 position.Z = newPosZ; 631 position.Z = newPosZ;
630 } 632 }
631 avatar.ControllingClient.SendTeleportLocationStart(); 633
634 // Only send this if the event queue is null
635 if (eq == null)
636 avatar.ControllingClient.SendTeleportLocationStart();
637
638
632 avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 639 avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags);
633 avatar.Teleport(position); 640 avatar.Teleport(position);
634 } 641 }
@@ -637,7 +644,9 @@ namespace OpenSim.Region.Environment.Scenes
637 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle); 644 RegionInfo reg = RequestNeighbouringRegionInfo(regionHandle);
638 if (reg != null) 645 if (reg != null)
639 { 646 {
640 avatar.ControllingClient.SendTeleportLocationStart(); 647 if (eq == null)
648 avatar.ControllingClient.SendTeleportLocationStart();
649
641 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); 650 AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
642 agent.BaseFolder = UUID.Zero; 651 agent.BaseFolder = UUID.Zero;
643 agent.InventoryFolder = UUID.Zero; 652 agent.InventoryFolder = UUID.Zero;
@@ -687,7 +696,7 @@ namespace OpenSim.Region.Environment.Scenes
687 m_log.DebugFormat( 696 m_log.DebugFormat(
688 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID); 697 "[CAPS]: Sending new CAPS seed url {0} to client {1}", capsPath, avatar.UUID);
689 698
690 IEventQueue eq = avatar.Scene.RequestModuleInterface<IEventQueue>(); 699
691 if (eq != null) 700 if (eq != null)
692 { 701 {
693 LLSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, reg.ExternalEndPoint, 702 LLSD Item = EventQueueHelper.TeleportFinishEvent(reg.RegionHandle, 13, reg.ExternalEndPoint,