diff options
author | diva | 2009-02-14 16:37:55 +0000 |
---|---|---|
committer | diva | 2009-02-14 16:37:55 +0000 |
commit | 217ffee8cb50e0a7ddfc0d4c4e4bb6a68de909d8 (patch) | |
tree | 3131df695140a7846fcd86b689c9a9afe5ee880f | |
parent | Thank you, patnad, for a patch that removes the "Subdivision of" text (diff) | |
download | opensim-SC-217ffee8cb50e0a7ddfc0d4c4e4bb6a68de909d8.zip opensim-SC-217ffee8cb50e0a7ddfc0d4c4e4bb6a68de909d8.tar.gz opensim-SC-217ffee8cb50e0a7ddfc0d4c4e4bb6a68de909d8.tar.bz2 opensim-SC-217ffee8cb50e0a7ddfc0d4c4e4bb6a68de909d8.tar.xz |
Moved RegionUp to REST/LocalComms. The original functionality has been entirely maintained, although it will have to be revisited soon, because it's buggy.
6 files changed, 361 insertions, 37 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index a0e5ba5..84751bd 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -31,6 +31,7 @@ using System.Net.Sockets; | |||
31 | using System.Xml; | 31 | using System.Xml; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenMetaverse.StructuredData; | ||
34 | 35 | ||
35 | namespace OpenSim.Framework | 36 | namespace OpenSim.Framework |
36 | { | 37 | { |
@@ -605,5 +606,73 @@ namespace OpenSim.Framework | |||
605 | configMember.forceSetConfigurationOption("lastmap_uuid", mapUUID.ToString()); | 606 | configMember.forceSetConfigurationOption("lastmap_uuid", mapUUID.ToString()); |
606 | configMember.forceSetConfigurationOption("lastmap_refresh", lastMapRefresh); | 607 | configMember.forceSetConfigurationOption("lastmap_refresh", lastMapRefresh); |
607 | } | 608 | } |
609 | |||
610 | public OSDMap PackRegionInfoData() | ||
611 | { | ||
612 | OSDMap args = new OSDMap(); | ||
613 | args["region_id"] = OSD.FromUUID(RegionID); | ||
614 | if ((RegionName != null) && !RegionName.Equals("")) | ||
615 | args["region_name"] = OSD.FromString(RegionName); | ||
616 | args["external_host_name"] = OSD.FromString(ExternalHostName); | ||
617 | args["http_port"] = OSD.FromString(HttpPort.ToString()); | ||
618 | args["server_uri"] = OSD.FromString(ServerURI); | ||
619 | args["region_xloc"] = OSD.FromString(RegionLocX.ToString()); | ||
620 | args["region_yloc"] = OSD.FromString(RegionLocY.ToString()); | ||
621 | args["internal_ep_address"] = OSD.FromString(InternalEndPoint.Address.ToString()); | ||
622 | args["internal_ep_port"] = OSD.FromString(InternalEndPoint.Port.ToString()); | ||
623 | if ((RemotingAddress != null) && !RemotingAddress.Equals("")) | ||
624 | args["remoting_address"] = OSD.FromString(RemotingAddress); | ||
625 | args["remoting_port"] = OSD.FromString(RemotingPort.ToString()); | ||
626 | args["allow_alt_ports"] = OSD.FromBoolean(m_allow_alternate_ports); | ||
627 | if ((proxyUrl != null) && !proxyUrl.Equals("")) | ||
628 | args["proxy_url"] = OSD.FromString(proxyUrl); | ||
629 | |||
630 | return args; | ||
631 | } | ||
632 | |||
633 | public void UnpackRegionInfoData(OSDMap args) | ||
634 | { | ||
635 | if (args["region_id"] != null) | ||
636 | RegionID = args["region_id"].AsUUID(); | ||
637 | if (args["region_name"] != null) | ||
638 | RegionName = args["region_name"].AsString(); | ||
639 | if (args["external_host_name"] != null) | ||
640 | ExternalHostName = args["external_host_name"].AsString(); | ||
641 | if (args["http_port"] != null) | ||
642 | UInt32.TryParse(args["http_port"].AsString(), out m_httpPort); | ||
643 | if (args["server_uri"] != null) | ||
644 | ServerURI = args["server_uri"].AsString(); | ||
645 | if (args["region_xloc"] != null) | ||
646 | { | ||
647 | uint locx; | ||
648 | UInt32.TryParse(args["region_xloc"].AsString(), out locx); | ||
649 | RegionLocX = locx; | ||
650 | } | ||
651 | if (args["region_yloc"] != null) | ||
652 | { | ||
653 | uint locy; | ||
654 | UInt32.TryParse(args["region_yloc"].AsString(), out locy); | ||
655 | RegionLocY = locy; | ||
656 | } | ||
657 | IPAddress ip_addr = null; | ||
658 | if (args["internal_ep_address"] != null) | ||
659 | { | ||
660 | IPAddress.TryParse(args["internal_ep_address"].AsString(), out ip_addr); | ||
661 | } | ||
662 | int port = 0; | ||
663 | if (args["internal_ep_port"] != null) | ||
664 | { | ||
665 | Int32.TryParse(args["internal_ep_port"].AsString(), out port); | ||
666 | } | ||
667 | InternalEndPoint = new IPEndPoint(ip_addr, port); | ||
668 | if (args["remoting_address"] != null) | ||
669 | RemotingAddress = args["remoting_address"].AsString(); | ||
670 | if (args["remoting_port"] != null) | ||
671 | UInt32.TryParse(args["remoting_port"].AsString(), out m_remotingPort); | ||
672 | if (args["allow_alt_ports"] != null) | ||
673 | m_allow_alternate_ports = args["allow_alt_ports"].AsBoolean(); | ||
674 | if (args["proxy_url"] != null) | ||
675 | proxyUrl = args["proxy_url"].AsString(); | ||
676 | } | ||
608 | } | 677 | } |
609 | } | 678 | } |
diff --git a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs index 6e813f4..29bc4f7 100644 --- a/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/Local/LocalInterregionComms.cs | |||
@@ -227,6 +227,23 @@ namespace OpenSim.Region.CoreModules.Communications.Local | |||
227 | return false; | 227 | return false; |
228 | } | 228 | } |
229 | 229 | ||
230 | /** | ||
231 | * Region-related communications | ||
232 | */ | ||
233 | |||
234 | public bool SendHelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
235 | { | ||
236 | foreach (Scene s in m_sceneList) | ||
237 | { | ||
238 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
239 | { | ||
240 | //m_log.Debug("[LOCAL COMMS]: Found region to SendHelloNeighbour"); | ||
241 | return s.IncomingHelloNeighbour(thisRegion); | ||
242 | } | ||
243 | } | ||
244 | return false; | ||
245 | } | ||
246 | |||
230 | #endregion /* IInterregionComms */ | 247 | #endregion /* IInterregionComms */ |
231 | 248 | ||
232 | #region Misc | 249 | #region Misc |
diff --git a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs index fcb3f5b..bc98337 100644 --- a/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/Communications/REST/RESTInterregionComms.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
45 | { | 45 | { |
46 | public class RESTInterregionComms : IRegionModule, IInterregionCommsOut | 46 | public class RESTInterregionComms : IRegionModule, IInterregionCommsOut |
47 | { | 47 | { |
48 | private bool initialized = false; | 48 | private static bool initialized = false; |
49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | protected bool m_enabled = false; | 51 | protected bool m_enabled = false; |
@@ -78,6 +78,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
78 | return; | 78 | return; |
79 | 79 | ||
80 | InitEach(scene); | 80 | InitEach(scene); |
81 | |||
81 | } | 82 | } |
82 | 83 | ||
83 | public virtual void PostInitialise() | 84 | public virtual void PostInitialise() |
@@ -115,8 +116,9 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
115 | 116 | ||
116 | protected virtual void AddHTTPHandlers() | 117 | protected virtual void AddHTTPHandlers() |
117 | { | 118 | { |
118 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/agent/", AgentHandler); | 119 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/agent/", AgentHandler); |
119 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/object/", ObjectHandler); | 120 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/object/", ObjectHandler); |
121 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/region/", RegionHandler); | ||
120 | } | 122 | } |
121 | 123 | ||
122 | #endregion /* IRegionModule */ | 124 | #endregion /* IRegionModule */ |
@@ -161,6 +163,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
161 | //else | 163 | //else |
162 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | 164 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); |
163 | return false; | 165 | return false; |
166 | |||
164 | } | 167 | } |
165 | 168 | ||
166 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) | 169 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) |
@@ -178,6 +181,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
178 | //else | 181 | //else |
179 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | 182 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); |
180 | return false; | 183 | return false; |
184 | |||
181 | } | 185 | } |
182 | 186 | ||
183 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) | 187 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) |
@@ -231,6 +235,32 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
231 | return false; | 235 | return false; |
232 | } | 236 | } |
233 | 237 | ||
238 | /** | ||
239 | * Region-related communications | ||
240 | */ | ||
241 | |||
242 | public bool SendHelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
243 | { | ||
244 | // Try local first | ||
245 | if (m_localBackend.SendHelloNeighbour(regionHandle, thisRegion)) | ||
246 | { | ||
247 | //m_log.Debug("[REST COMMS]: LocalBackEnd SendHelloNeighbour succeeded"); | ||
248 | return true; | ||
249 | } | ||
250 | |||
251 | // else do the remote thing | ||
252 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
253 | if ((regInfo != null) && | ||
254 | // Don't remote-call this instance; that's a startup hickup | ||
255 | !((regInfo.ExternalHostName == thisRegion.ExternalHostName) && (regInfo.HttpPort == thisRegion.HttpPort))) | ||
256 | { | ||
257 | return DoHelloNeighbourCall(regInfo, thisRegion); | ||
258 | } | ||
259 | //else | ||
260 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
261 | return false; | ||
262 | } | ||
263 | |||
234 | #endregion /* IInterregionComms */ | 264 | #endregion /* IInterregionComms */ |
235 | 265 | ||
236 | #region DoWork functions for the above public interface | 266 | #region DoWork functions for the above public interface |
@@ -482,7 +512,7 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
482 | 512 | ||
483 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); | 513 | WebRequest ObjectCreateRequest = WebRequest.Create(uri); |
484 | ObjectCreateRequest.Method = "POST"; | 514 | ObjectCreateRequest.Method = "POST"; |
485 | ObjectCreateRequest.ContentType = "text/xml"; | 515 | ObjectCreateRequest.ContentType = "application/json"; |
486 | ObjectCreateRequest.Timeout = 10000; | 516 | ObjectCreateRequest.Timeout = 10000; |
487 | 517 | ||
488 | OSDMap args = new OSDMap(2); | 518 | OSDMap args = new OSDMap(2); |
@@ -555,6 +585,90 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
555 | 585 | ||
556 | } | 586 | } |
557 | 587 | ||
588 | protected bool DoHelloNeighbourCall(RegionInfo region, RegionInfo thisRegion) | ||
589 | { | ||
590 | string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/region/" + thisRegion.RegionID + "/"; | ||
591 | //Console.WriteLine(" >>> DoHelloNeighbourCall <<< " + uri); | ||
592 | |||
593 | WebRequest HelloNeighbourRequest = WebRequest.Create(uri); | ||
594 | HelloNeighbourRequest.Method = "POST"; | ||
595 | HelloNeighbourRequest.ContentType = "application/json"; | ||
596 | HelloNeighbourRequest.Timeout = 10000; | ||
597 | |||
598 | // Fill it in | ||
599 | OSDMap args = null; | ||
600 | try | ||
601 | { | ||
602 | args = thisRegion.PackRegionInfoData(); | ||
603 | } | ||
604 | catch (Exception e) | ||
605 | { | ||
606 | m_log.Debug("[REST COMMS]: PackRegionInfoData failed with exception: " + e.Message); | ||
607 | } | ||
608 | // Add the regionhandle of the destination region | ||
609 | ulong regionHandle = GetRegionHandle(region.RegionHandle); | ||
610 | args["destination_handle"] = OSD.FromString(regionHandle.ToString()); | ||
611 | |||
612 | string strBuffer = ""; | ||
613 | byte[] buffer = new byte[1]; | ||
614 | try | ||
615 | { | ||
616 | strBuffer = OSDParser.SerializeJsonString(args); | ||
617 | UTF8Encoding str = new UTF8Encoding(); | ||
618 | buffer = str.GetBytes(strBuffer); | ||
619 | |||
620 | } | ||
621 | catch (Exception e) | ||
622 | { | ||
623 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of HelloNeighbour: {0}", e.Message); | ||
624 | // ignore. buffer will be empty, caller should check. | ||
625 | } | ||
626 | |||
627 | Stream os = null; | ||
628 | try | ||
629 | { // send the Post | ||
630 | HelloNeighbourRequest.ContentLength = buffer.Length; //Count bytes to send | ||
631 | os = HelloNeighbourRequest.GetRequestStream(); | ||
632 | os.Write(buffer, 0, strBuffer.Length); //Send it | ||
633 | os.Close(); | ||
634 | //m_log.InfoFormat("[REST COMMS]: Posted HelloNeighbour request to remote sim {0}", uri); | ||
635 | } | ||
636 | //catch (WebException ex) | ||
637 | catch | ||
638 | { | ||
639 | //m_log.InfoFormat("[REST COMMS]: Bad send on HelloNeighbour {0}", ex.Message); | ||
640 | |||
641 | return false; | ||
642 | } | ||
643 | |||
644 | // Let's wait for the response | ||
645 | //m_log.Info("[REST COMMS]: Waiting for a reply after DoHelloNeighbourCall"); | ||
646 | |||
647 | try | ||
648 | { | ||
649 | WebResponse webResponse = HelloNeighbourRequest.GetResponse(); | ||
650 | if (webResponse == null) | ||
651 | { | ||
652 | m_log.Info("[REST COMMS]: Null reply on DoHelloNeighbourCall post"); | ||
653 | } | ||
654 | |||
655 | StreamReader sr = new StreamReader(webResponse.GetResponseStream()); | ||
656 | //reply = sr.ReadToEnd().Trim(); | ||
657 | sr.ReadToEnd().Trim(); | ||
658 | sr.Close(); | ||
659 | //m_log.InfoFormat("[REST COMMS]: DoHelloNeighbourCall reply was {0} ", reply); | ||
660 | |||
661 | } | ||
662 | catch (WebException ex) | ||
663 | { | ||
664 | m_log.InfoFormat("[REST COMMS]: exception on reply of DoHelloNeighbourCall {0}", ex.Message); | ||
665 | // ignore, really | ||
666 | } | ||
667 | |||
668 | return true; | ||
669 | |||
670 | } | ||
671 | |||
558 | #endregion /* Do Work */ | 672 | #endregion /* Do Work */ |
559 | 673 | ||
560 | #region Incoming calls from remote instances | 674 | #region Incoming calls from remote instances |
@@ -617,33 +731,6 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
617 | 731 | ||
618 | } | 732 | } |
619 | 733 | ||
620 | protected OSDMap GetOSDMap(Hashtable request) | ||
621 | { | ||
622 | OSDMap args = null; | ||
623 | try | ||
624 | { | ||
625 | OSD buffer; | ||
626 | // We should pay attention to the content-type, but let's assume we know it's Json | ||
627 | buffer = OSDParser.DeserializeJson((string)request["body"]); | ||
628 | if (buffer.Type == OSDType.Map) | ||
629 | { | ||
630 | args = (OSDMap)buffer; | ||
631 | return args; | ||
632 | } | ||
633 | else | ||
634 | { | ||
635 | // uh? | ||
636 | m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); | ||
637 | return null; | ||
638 | } | ||
639 | } | ||
640 | catch (Exception ex) | ||
641 | { | ||
642 | m_log.InfoFormat("[REST COMMS]: exception on parse of REST message {0}", ex.Message); | ||
643 | return null; | ||
644 | } | ||
645 | } | ||
646 | |||
647 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) | 734 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) |
648 | { | 735 | { |
649 | OSDMap args = GetOSDMap(request); | 736 | OSDMap args = GetOSDMap(request); |
@@ -868,10 +955,129 @@ namespace OpenSim.Region.CoreModules.Communications.REST | |||
868 | responsedata["str_response_string"] = result.ToString(); | 955 | responsedata["str_response_string"] = result.ToString(); |
869 | } | 956 | } |
870 | 957 | ||
958 | /* | ||
959 | * Region-related incoming calls | ||
960 | * | ||
961 | */ | ||
962 | |||
963 | public Hashtable RegionHandler(Hashtable request) | ||
964 | { | ||
965 | //m_log.Debug("[CONNECTION DEBUGGING]: RegionHandler Called"); | ||
966 | |||
967 | //Console.WriteLine("---------------------------"); | ||
968 | //Console.WriteLine(" >> uri=" + request["uri"]); | ||
969 | //Console.WriteLine(" >> content-type=" + request["content-type"]); | ||
970 | //Console.WriteLine(" >> http-method=" + request["http-method"]); | ||
971 | //Console.WriteLine("---------------------------\n"); | ||
972 | |||
973 | Hashtable responsedata = new Hashtable(); | ||
974 | responsedata["content_type"] = "text/html"; | ||
975 | |||
976 | UUID regionID; | ||
977 | string action; | ||
978 | ulong regionHandle; | ||
979 | if (!GetParams((string)request["uri"], out regionID, out regionHandle, out action)) | ||
980 | { | ||
981 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for object message {0}", request["uri"]); | ||
982 | responsedata["int_response_code"] = 404; | ||
983 | responsedata["str_response_string"] = "false"; | ||
984 | |||
985 | return responsedata; | ||
986 | } | ||
987 | |||
988 | // Next, let's parse the verb | ||
989 | string method = (string)request["http-method"]; | ||
990 | if (method.Equals("POST")) | ||
991 | { | ||
992 | DoRegionPost(request, responsedata, regionID); | ||
993 | return responsedata; | ||
994 | } | ||
995 | //else if (method.Equals("PUT")) | ||
996 | //{ | ||
997 | // DoRegionPut(request, responsedata, regionID); | ||
998 | // return responsedata; | ||
999 | //} | ||
1000 | //else if (method.Equals("DELETE")) | ||
1001 | //{ | ||
1002 | // DoRegionDelete(request, responsedata, regiontID); | ||
1003 | // return responsedata; | ||
1004 | //} | ||
1005 | else | ||
1006 | { | ||
1007 | m_log.InfoFormat("[REST COMMS]: method {0} not supported in region message", method); | ||
1008 | responsedata["int_response_code"] = 404; | ||
1009 | responsedata["str_response_string"] = "false"; | ||
1010 | |||
1011 | return responsedata; | ||
1012 | } | ||
1013 | |||
1014 | } | ||
1015 | |||
1016 | protected virtual void DoRegionPost(Hashtable request, Hashtable responsedata, UUID id) | ||
1017 | { | ||
1018 | OSDMap args = GetOSDMap(request); | ||
1019 | if (args == null) | ||
1020 | { | ||
1021 | responsedata["int_response_code"] = 400; | ||
1022 | responsedata["str_response_string"] = "false"; | ||
1023 | return; | ||
1024 | } | ||
1025 | |||
1026 | // retrieve the regionhandle | ||
1027 | ulong regionhandle = 0; | ||
1028 | if (args["destination_handle"] != null) | ||
1029 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | ||
1030 | |||
1031 | RegionInfo aRegion = new RegionInfo(); | ||
1032 | try | ||
1033 | { | ||
1034 | aRegion.UnpackRegionInfoData(args); | ||
1035 | } | ||
1036 | catch (Exception ex) | ||
1037 | { | ||
1038 | m_log.InfoFormat("[REST COMMS]: exception on unpacking HelloNeighbour message {0}", ex.Message); | ||
1039 | return; | ||
1040 | } | ||
1041 | |||
1042 | // This is the meaning of POST region | ||
1043 | bool result = m_localBackend.SendHelloNeighbour(regionhandle, aRegion); | ||
1044 | |||
1045 | responsedata["int_response_code"] = 200; | ||
1046 | responsedata["str_response_string"] = result.ToString(); | ||
1047 | } | ||
1048 | |||
1049 | |||
871 | #endregion | 1050 | #endregion |
872 | 1051 | ||
873 | #region Misc | 1052 | #region Misc |
874 | 1053 | ||
1054 | protected OSDMap GetOSDMap(Hashtable request) | ||
1055 | { | ||
1056 | OSDMap args = null; | ||
1057 | try | ||
1058 | { | ||
1059 | OSD buffer; | ||
1060 | // We should pay attention to the content-type, but let's assume we know it's Json | ||
1061 | buffer = OSDParser.DeserializeJson((string)request["body"]); | ||
1062 | if (buffer.Type == OSDType.Map) | ||
1063 | { | ||
1064 | args = (OSDMap)buffer; | ||
1065 | return args; | ||
1066 | } | ||
1067 | else | ||
1068 | { | ||
1069 | // uh? | ||
1070 | m_log.Debug("[REST COMMS]: Got OSD of type " + buffer.Type.ToString()); | ||
1071 | return null; | ||
1072 | } | ||
1073 | } | ||
1074 | catch (Exception ex) | ||
1075 | { | ||
1076 | m_log.InfoFormat("[REST COMMS]: exception on parse of REST message {0}", ex.Message); | ||
1077 | return null; | ||
1078 | } | ||
1079 | } | ||
1080 | |||
875 | /// <summary> | 1081 | /// <summary> |
876 | /// Extract the param from an uri. | 1082 | /// Extract the param from an uri. |
877 | /// </summary> | 1083 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs index d3f44bb..0b62df2 100644 --- a/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs +++ b/OpenSim/Region/Framework/Interfaces/IInterregionComms.cs | |||
@@ -32,8 +32,11 @@ namespace OpenSim.Region.Framework.Interfaces | |||
32 | { | 32 | { |
33 | public delegate bool ChildAgentUpdateReceived(AgentData data); | 33 | public delegate bool ChildAgentUpdateReceived(AgentData data); |
34 | 34 | ||
35 | public interface IInterregionCommsOut | 35 | public interface IInterregionCommsOut |
36 | { | 36 | { |
37 | |||
38 | #region Agents | ||
39 | |||
37 | bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit); | 40 | bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit); |
38 | 41 | ||
39 | /// <summary> | 42 | /// <summary> |
@@ -70,8 +73,26 @@ namespace OpenSim.Region.Framework.Interfaces | |||
70 | /// <returns></returns> | 73 | /// <returns></returns> |
71 | bool SendCloseAgent(ulong regionHandle, UUID id); | 74 | bool SendCloseAgent(ulong regionHandle, UUID id); |
72 | 75 | ||
76 | #endregion Agents | ||
77 | |||
78 | #region Objects | ||
79 | |||
80 | /// <summary> | ||
81 | /// Create an object in the destination region. This message is used primarily for prim crossing. | ||
82 | /// </summary> | ||
83 | /// <param name="regionHandle"></param> | ||
84 | /// <param name="sog"></param> | ||
85 | /// <param name="isLocalCall"></param> | ||
86 | /// <returns></returns> | ||
73 | bool SendCreateObject(ulong regionHandle, ISceneObject sog, bool isLocalCall); | 87 | bool SendCreateObject(ulong regionHandle, ISceneObject sog, bool isLocalCall); |
74 | 88 | ||
89 | #endregion Objects | ||
90 | |||
91 | #region Regions | ||
92 | |||
93 | bool SendHelloNeighbour(ulong regionHandle, RegionInfo thisRegion); | ||
94 | |||
95 | #endregion Regions | ||
75 | } | 96 | } |
76 | 97 | ||
77 | // This may not be needed, but having it here for now. | 98 | // This may not be needed, but having it here for now. |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c31e6f7..b42c46e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -422,6 +422,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
422 | /// <returns>True after all operations complete, throws exceptions otherwise.</returns> | 422 | /// <returns>True after all operations complete, throws exceptions otherwise.</returns> |
423 | public override bool OtherRegionUp(RegionInfo otherRegion) | 423 | public override bool OtherRegionUp(RegionInfo otherRegion) |
424 | { | 424 | { |
425 | m_log.InfoFormat("[SCENE]: Region {0} up in coords {1}-{2}", otherRegion.RegionName, otherRegion.RegionLocX, otherRegion.RegionLocY); | ||
426 | |||
425 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) | 427 | if (RegionInfo.RegionHandle != otherRegion.RegionHandle) |
426 | { | 428 | { |
427 | for (int i = 0; i < m_neighbours.Count; i++) | 429 | for (int i = 0; i < m_neighbours.Count; i++) |
@@ -517,6 +519,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
517 | return found; | 519 | return found; |
518 | } | 520 | } |
519 | 521 | ||
522 | |||
523 | // Alias IncomingHelloNeighbour OtherRegionUp, for now | ||
524 | public bool IncomingHelloNeighbour(RegionInfo neighbour) | ||
525 | { | ||
526 | return OtherRegionUp(neighbour); | ||
527 | } | ||
528 | |||
520 | /// <summary> | 529 | /// <summary> |
521 | /// Given float seconds, this will restart the region. | 530 | /// Given float seconds, this will restart the region. |
522 | /// </summary> | 531 | /// </summary> |
@@ -2569,7 +2578,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2569 | /// <param name="region"></param> | 2578 | /// <param name="region"></param> |
2570 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | 2579 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) |
2571 | { | 2580 | { |
2572 | m_sceneGridService.InformNeighborChildAgent(presence, region, m_neighbours); | 2581 | m_sceneGridService.InformNeighborChildAgent(presence, region); |
2573 | } | 2582 | } |
2574 | 2583 | ||
2575 | /// <summary> | 2584 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 2f0bbb2..4c10e2c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
459 | /// This informs a single neighboring region about agent "avatar". | 459 | /// This informs a single neighboring region about agent "avatar". |
460 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | 460 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. |
461 | /// </summary> | 461 | /// </summary> |
462 | public void InformNeighborChildAgent(ScenePresence avatar, SimpleRegionInfo region, List<RegionInfo> neighbours) | 462 | public void InformNeighborChildAgent(ScenePresence avatar, SimpleRegionInfo region) |
463 | { | 463 | { |
464 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); | 464 | AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo(); |
465 | agent.BaseFolder = UUID.Zero; | 465 | agent.BaseFolder = UUID.Zero; |
@@ -493,8 +493,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
493 | m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); | 493 | m_log.Info("[INTERGRID]: Starting to inform neighbors that I'm here"); |
494 | //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); | 494 | //RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); |
495 | 495 | ||
496 | bool regionAccepted = | 496 | //bool regionAccepted = |
497 | m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle); | 497 | // m_commsProvider.InterRegion.RegionUp(new SerializableRegionInfo(region), regionhandle); |
498 | |||
499 | bool regionAccepted = m_interregionCommsOut.SendHelloNeighbour(regionhandle, region); | ||
498 | 500 | ||
499 | if (regionAccepted) | 501 | if (regionAccepted) |
500 | { | 502 | { |
@@ -519,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
519 | { | 521 | { |
520 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); | 522 | //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); |
521 | 523 | ||
522 | 524 | ||
523 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); | 525 | List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>(); |
524 | // This stays uncached because we don't already know about our neighbors at this point. | 526 | // This stays uncached because we don't already know about our neighbors at this point. |
525 | neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); | 527 | neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); |