diff options
Pulled out HelloNeighbour into its own service, INeighbourService, which may get more functions as we go along. It's a very simple service and service connectors, and it served primarily to establish the design of services that dependent on Scenes and that must always have a local connector. More refactoring coming, as this showed how to do it right.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs index dd37d47..37305d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs | |||
@@ -130,7 +130,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | |||
130 | { | 130 | { |
131 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/agent/", AgentHandler); | 131 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/agent/", AgentHandler); |
132 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/object/", ObjectHandler); | 132 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/object/", ObjectHandler); |
133 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/region/", RegionHandler); | ||
134 | } | 133 | } |
135 | 134 | ||
136 | #endregion /* IRegionModule */ | 135 | #endregion /* IRegionModule */ |
@@ -291,32 +290,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | |||
291 | return false; | 290 | return false; |
292 | } | 291 | } |
293 | 292 | ||
294 | /** | ||
295 | * Region-related communications | ||
296 | */ | ||
297 | |||
298 | public bool SendHelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
299 | { | ||
300 | // Try local first | ||
301 | if (m_localBackend.SendHelloNeighbour(regionHandle, thisRegion)) | ||
302 | { | ||
303 | //m_log.Debug("[REST COMMS]: LocalBackEnd SendHelloNeighbour succeeded"); | ||
304 | return true; | ||
305 | } | ||
306 | |||
307 | // else do the remote thing | ||
308 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
309 | if ((regInfo != null) && | ||
310 | // Don't remote-call this instance; that's a startup hickup | ||
311 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) | ||
312 | { | ||
313 | return m_regionClient.DoHelloNeighbourCall(regInfo, thisRegion); | ||
314 | } | ||
315 | //else | ||
316 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
317 | return false; | ||
318 | } | ||
319 | |||
320 | #endregion /* IInterregionComms */ | 293 | #endregion /* IInterregionComms */ |
321 | 294 | ||
322 | #region Incoming calls from remote instances | 295 | #region Incoming calls from remote instances |
@@ -702,98 +675,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | |||
702 | responsedata["str_response_string"] = result.ToString(); | 675 | responsedata["str_response_string"] = result.ToString(); |
703 | } | 676 | } |
704 | 677 | ||
705 | /* | ||
706 | * Region-related incoming calls | ||
707 | * | ||
708 | */ | ||
709 | |||
710 | public Hashtable RegionHandler(Hashtable request) | ||
711 | { | ||
712 | //m_log.Debug("[CONNECTION DEBUGGING]: RegionHandler Called"); | ||
713 | |||
714 | //m_log.Debug("---------------------------"); | ||
715 | //m_log.Debug(" >> uri=" + request["uri"]); | ||
716 | //m_log.Debug(" >> content-type=" + request["content-type"]); | ||
717 | //m_log.Debug(" >> http-method=" + request["http-method"]); | ||
718 | //m_log.Debug("---------------------------\n"); | ||
719 | |||
720 | Hashtable responsedata = new Hashtable(); | ||
721 | responsedata["content_type"] = "text/html"; | ||
722 | |||
723 | UUID regionID; | ||
724 | string action; | ||
725 | ulong regionHandle; | ||
726 | if (!GetParams((string)request["uri"], out regionID, out regionHandle, out action)) | ||
727 | { | ||
728 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for object message {0}", request["uri"]); | ||
729 | responsedata["int_response_code"] = 404; | ||
730 | responsedata["str_response_string"] = "false"; | ||
731 | |||
732 | return responsedata; | ||
733 | } | ||
734 | |||
735 | // Next, let's parse the verb | ||
736 | string method = (string)request["http-method"]; | ||
737 | if (method.Equals("POST")) | ||
738 | { | ||
739 | DoRegionPost(request, responsedata, regionID); | ||
740 | return responsedata; | ||
741 | } | ||
742 | //else if (method.Equals("PUT")) | ||
743 | //{ | ||
744 | // DoRegionPut(request, responsedata, regionID); | ||
745 | // return responsedata; | ||
746 | //} | ||
747 | //else if (method.Equals("DELETE")) | ||
748 | //{ | ||
749 | // DoRegionDelete(request, responsedata, regiontID); | ||
750 | // return responsedata; | ||
751 | //} | ||
752 | else | ||
753 | { | ||
754 | m_log.InfoFormat("[REST COMMS]: method {0} not supported in region message", method); | ||
755 | responsedata["int_response_code"] = 404; | ||
756 | responsedata["str_response_string"] = "false"; | ||
757 | |||
758 | return responsedata; | ||
759 | } | ||
760 | |||
761 | } | ||
762 | |||
763 | protected virtual void DoRegionPost(Hashtable request, Hashtable responsedata, UUID id) | ||
764 | { | ||
765 | OSDMap args = RegionClient.GetOSDMap((string)request["body"]); | ||
766 | if (args == null) | ||
767 | { | ||
768 | responsedata["int_response_code"] = 400; | ||
769 | responsedata["str_response_string"] = "false"; | ||
770 | return; | ||
771 | } | ||
772 | |||
773 | // retrieve the regionhandle | ||
774 | ulong regionhandle = 0; | ||
775 | if (args["destination_handle"] != null) | ||
776 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | ||
777 | |||
778 | RegionInfo aRegion = new RegionInfo(); | ||
779 | try | ||
780 | { | ||
781 | aRegion.UnpackRegionInfoData(args); | ||
782 | } | ||
783 | catch (Exception ex) | ||
784 | { | ||
785 | m_log.InfoFormat("[REST COMMS]: exception on unpacking HelloNeighbour message {0}", ex.Message); | ||
786 | return; | ||
787 | } | ||
788 | |||
789 | // This is the meaning of POST region | ||
790 | bool result = m_localBackend.SendHelloNeighbour(regionhandle, aRegion); | ||
791 | |||
792 | responsedata["int_response_code"] = 200; | ||
793 | responsedata["str_response_string"] = result.ToString(); | ||
794 | } | ||
795 | |||
796 | |||
797 | #endregion | 678 | #endregion |
798 | 679 | ||
799 | #region Misc | 680 | #region Misc |