diff options
Split agent updates into two messages: full update and position+camera update. They're both sent over HTTP PUT. The full update is sent on TPs, for now; later it will also be sent on region crossings.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Communications/REST/RESTInterregionComms.cs | 68 |
1 files changed, 58 insertions, 10 deletions
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; |