aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs15
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs68
2 files changed, 73 insertions, 10 deletions
diff --git a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
index 9f547a2..135a05e 100644
--- a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
@@ -133,6 +133,21 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
133 return false; 133 return false;
134 } 134 }
135 135
136 public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
137 {
138 foreach (Scene s in m_sceneList)
139 {
140 if (s.RegionInfo.RegionHandle == regionHandle)
141 {
142 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
143 s.IncomingChildAgentDataUpdate(cAgentData);
144 return true;
145 }
146 }
147 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
148 return false;
149 }
150
136 public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) 151 public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
137 { 152 {
138 //uint x, y; 153 //uint x, y;
diff --git a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
index f48e474..bff8316 100644
--- a/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs
@@ -146,6 +146,23 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
146 146
147 } 147 }
148 148
149 public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData)
150 {
151 // Try local first
152 if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData))
153 return true;
154
155 // else do the remote thing
156 RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle);
157 if (regInfo != null)
158 {
159 return DoChildAgentUpdateCall(regInfo, cAgentData);
160 }
161 //else
162 // m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
163 return false;
164
165 }
149 public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) 166 public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri)
150 { 167 {
151 // Try local first 168 // Try local first
@@ -180,7 +197,7 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
180 // Internal functions for the above public interface 197 // Internal functions for the above public interface
181 //------------------------------------------------------------------- 198 //-------------------------------------------------------------------
182 199
183 protected bool DoChildAgentUpdateCall(RegionInfo region, AgentData cAgentData) 200 protected bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData)
184 { 201 {
185 // Eventually, we want to use a caps url instead of the agentID 202 // Eventually, we want to use a caps url instead of the agentID
186 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/"; 203 string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/agent/" + cAgentData.AgentID + "/";
@@ -436,20 +453,51 @@ namespace OpenSim.Region.Environment.Modules.Communications.REST
436 if (args["destination_handle"] != null) 453 if (args["destination_handle"] != null)
437 UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); 454 UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle);
438 455
439 AgentData agent = new AgentData(); 456 string messageType;
440 try 457 if (args["message_type"] != null)
458 messageType = args["message_type"].AsString();
459 else
441 { 460 {
442 agent.UnpackUpdateMessage(args); 461 m_log.Warn("[REST COMMS]: Agent Put Message Type not found. ");
462 messageType = "AgentData";
443 } 463 }
444 catch (Exception ex) 464
465 bool result = true;
466 if ("AgentData".Equals(messageType))
445 { 467 {
446 m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); 468 AgentData agent = new AgentData();
447 return; 469 try
470 {
471 agent.UnpackUpdateMessage(args);
472 }
473 catch (Exception ex)
474 {
475 m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
476 return;
477 }
478 //agent.Dump();
479 // This is one of the meanings of PUT agent
480 result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
481
482 }
483 else if ("AgentPosition".Equals(messageType))
484 {
485 AgentPosition agent = new AgentPosition();
486 try
487 {
488 agent.UnpackUpdateMessage(args);
489 }
490 catch (Exception ex)
491 {
492 m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message);
493 return;
494 }
495 //agent.Dump();
496 // This is one of the meanings of PUT agent
497 result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
498
448 } 499 }
449 //agent.Dump();
450 500
451 // This is the meaning of PUT agent
452 bool result = m_localBackend.SendChildAgentUpdate(regionhandle, agent);
453 501
454 502
455 responsedata["int_response_code"] = 200; 503 responsedata["int_response_code"] = 200;