diff options
author | diva | 2009-02-20 03:39:50 +0000 |
---|---|---|
committer | diva | 2009-02-20 03:39:50 +0000 |
commit | 33330297d603a66cc157baa21c81328edc893e51 (patch) | |
tree | 264c9cc750e08383d4f126a66e6def4176dc2fa9 /OpenSim/Region | |
parent | Update svn properties, add copyright headers, minor formatting cleanup. (diff) | |
download | opensim-SC-33330297d603a66cc157baa21c81328edc893e51.zip opensim-SC-33330297d603a66cc157baa21c81328edc893e51.tar.gz opensim-SC-33330297d603a66cc157baa21c81328edc893e51.tar.bz2 opensim-SC-33330297d603a66cc157baa21c81328edc893e51.tar.xz |
THE BIG ANTI-REMOTING SCHLEP -- StartRemoting is no more. Sims in older versions will have a hard time communicating with sims on this release and later, especially if they haven't transitioned to RESTComms at all.
There's still some cleanup to do on assorted data structures, but the main functional change here is that sims no longer listen on remoting ports.
Diffstat (limited to '')
14 files changed, 6 insertions, 2573 deletions
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs index 0a8075c..6ec00fe 100644 --- a/OpenSim/Region/Application/HGOpenSimNode.cs +++ b/OpenSim/Region/Application/HGOpenSimNode.cs | |||
@@ -95,7 +95,7 @@ namespace OpenSim | |||
95 | 95 | ||
96 | 96 | ||
97 | m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache, | 97 | m_commsManager = new HGCommunicationsStandalone(m_networkServersInfo, m_httpServer, m_assetCache, |
98 | userService, userService, inventoryService, gridService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile); | 98 | userService, userService, inventoryService, gridService, userService, libraryRootFolder, m_configSettings.DumpAssetsToFile); |
99 | 99 | ||
100 | inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService; | 100 | inventoryService.UserProfileCache = m_commsManager.UserProfileCacheService; |
101 | HGServices = gridService; | 101 | HGServices = gridService; |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 54822d0..ad7d06f 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -274,7 +274,7 @@ namespace OpenSim | |||
274 | m_commsManager | 274 | m_commsManager |
275 | = new CommunicationsLocal( | 275 | = new CommunicationsLocal( |
276 | m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, | 276 | m_networkServersInfo, m_httpServer, m_assetCache, userService, userService, |
277 | inventoryService, backendService, backendService, userService, | 277 | inventoryService, backendService, userService, |
278 | libraryRootFolder, m_configSettings.DumpAssetsToFile); | 278 | libraryRootFolder, m_configSettings.DumpAssetsToFile); |
279 | 279 | ||
280 | // set up XMLRPC handler for client's initial login request message | 280 | // set up XMLRPC handler for client's initial login request message |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs index c8a540b..8b7c3d1 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsGridMode.cs | |||
@@ -56,7 +56,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
56 | // From constructor at CommunicationsOGS1 | 56 | // From constructor at CommunicationsOGS1 |
57 | HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService); | 57 | HGGridServices gridInterComms = new HGGridServicesGridMode(serversInfo, httpServer, assetCache, sman, m_userProfileCacheService); |
58 | m_gridService = gridInterComms; | 58 | m_gridService = gridInterComms; |
59 | m_interRegion = gridInterComms; | ||
60 | m_osw = gridInterComms; | 59 | m_osw = gridInterComms; |
61 | 60 | ||
62 | // The HG InventoryService always uses secure handlers | 61 | // The HG InventoryService always uses secure handlers |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs index 5feea4d..21e651d 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGCommunicationsStandalone.cs | |||
@@ -44,9 +44,8 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
44 | IUserService userService, | 44 | IUserService userService, |
45 | IUserAdminService userServiceAdmin, | 45 | IUserAdminService userServiceAdmin, |
46 | LocalInventoryService inventoryService, | 46 | LocalInventoryService inventoryService, |
47 | IInterRegionCommunications interRegionService, | ||
48 | HGGridServices gridService, IMessagingService messageService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) | 47 | HGGridServices gridService, IMessagingService messageService, LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) |
49 | : base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, interRegionService, gridService, messageService, libraryRootFolder, dumpAssetsToFile) | 48 | : base(serversInfo, httpServer, assetCache, userService, userServiceAdmin, inventoryService, gridService, messageService, libraryRootFolder, dumpAssetsToFile) |
50 | { | 49 | { |
51 | gridService.UserProfileCache = m_userProfileCacheService; | 50 | gridService.UserProfileCache = m_userProfileCacheService; |
52 | m_assetCache = assetCache; | 51 | m_assetCache = assetCache; |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs index 24db63e..08d74f3 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs | |||
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
55 | /// hyperlinks, as well as processing all the inter-region comms between a region and | 55 | /// hyperlinks, as well as processing all the inter-region comms between a region and |
56 | /// an hyperlinked region. | 56 | /// an hyperlinked region. |
57 | /// </summary> | 57 | /// </summary> |
58 | public class HGGridServices : IGridServices, IInterRegionCommunications, IHyperlink | 58 | public class HGGridServices : IGridServices, IHyperlink |
59 | { | 59 | { |
60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
61 | 61 | ||
@@ -777,80 +777,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
777 | return resp; | 777 | return resp; |
778 | } | 778 | } |
779 | 779 | ||
780 | #region IInterRegionCommunications interface | ||
781 | |||
782 | public virtual bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) { return false; } | ||
783 | public virtual bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) { return false; } | ||
784 | public virtual bool CheckRegion(string address, uint port) { return false; } | ||
785 | public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) { return false; } | ||
786 | |||
787 | public virtual bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) { | ||
788 | // Remote region | ||
789 | RegionInfo regInfo = null; | ||
790 | ulong remoteHandle = 0; | ||
791 | try | ||
792 | { | ||
793 | regInfo = RequestNeighbourInfo(regionHandle); | ||
794 | if (regInfo != null) | ||
795 | { | ||
796 | try | ||
797 | { | ||
798 | remoteHandle = Convert.ToUInt64(regInfo.regionSecret); | ||
799 | } | ||
800 | catch | ||
801 | { | ||
802 | m_log.Warn("[HGrid]: Invalid remote region with handle " + regInfo.regionSecret); | ||
803 | return false; | ||
804 | } | ||
805 | //Console.WriteLine("XXX---- Sending Expectavatarcrossing into : " + remoteHandle); | ||
806 | |||
807 | bool retValue = false; | ||
808 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
809 | typeof(OGS1InterRegionRemoting), | ||
810 | "tcp://" + regInfo.RemotingAddress + | ||
811 | ":" + regInfo.RemotingPort + | ||
812 | "/InterRegions"); | ||
813 | |||
814 | if (remObject != null) | ||
815 | { | ||
816 | retValue = | ||
817 | remObject.ExpectAvatarCrossing(remoteHandle, agentID.Guid, new sLLVector3(position), | ||
818 | isFlying); | ||
819 | } | ||
820 | else | ||
821 | { | ||
822 | m_log.Warn("[HGrid]: Remoting object not found"); | ||
823 | } | ||
824 | remObject = null; | ||
825 | |||
826 | return retValue; | ||
827 | } | ||
828 | //TODO need to see if we know about where this region is and use .net remoting | ||
829 | // to inform it. | ||
830 | //NoteDeadRegion(regionHandle); | ||
831 | return false; | ||
832 | } | ||
833 | catch (RemotingException e) | ||
834 | { | ||
835 | // NoteDeadRegion(regionHandle); | ||
836 | |||
837 | m_log.WarnFormat( | ||
838 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
839 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
840 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
841 | |||
842 | return false; | ||
843 | } | ||
844 | catch | ||
845 | { | ||
846 | // NoteDeadRegion(regionHandle); | ||
847 | return false; | ||
848 | } | ||
849 | |||
850 | } | ||
851 | |||
852 | public virtual bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) { return false; } | ||
853 | |||
854 | public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData) | 780 | public bool SendUserInformation(RegionInfo regInfo, AgentCircuitData agentData) |
855 | { | 781 | { |
856 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | 782 | CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); |
@@ -887,260 +813,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
887 | return true; | 813 | return true; |
888 | } | 814 | } |
889 | 815 | ||
890 | public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
891 | { | ||
892 | // If we're here, it's because regionHandle is a remote, non-grided region | ||
893 | m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle); | ||
894 | |||
895 | RegionInfo regInfo = GetHyperlinkRegion(regionHandle); | ||
896 | if (regInfo == null) | ||
897 | return false; | ||
898 | |||
899 | //ulong realHandle = regionHandle; | ||
900 | |||
901 | if (!SendUserInformation(regInfo, agentData)) | ||
902 | { | ||
903 | m_log.Warn("[HGrid]: Failed to inform remote region of user."); | ||
904 | //return false; | ||
905 | } | ||
906 | |||
907 | try | ||
908 | { | ||
909 | // ... and then | ||
910 | |||
911 | m_log.Debug("[HGrid]: Region is hyperlink."); | ||
912 | bool retValue = false; | ||
913 | try | ||
914 | { | ||
915 | regionHandle = Convert.ToUInt64(regInfo.regionSecret); | ||
916 | } | ||
917 | catch (Exception) | ||
918 | { | ||
919 | m_log.Warn("[HGrid]: Invalid hyperlink region."); | ||
920 | return false; | ||
921 | } | ||
922 | |||
923 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
924 | typeof(OGS1InterRegionRemoting), | ||
925 | "tcp://" + regInfo.RemotingAddress + | ||
926 | ":" + regInfo.RemotingPort + | ||
927 | "/InterRegions"); | ||
928 | |||
929 | if (remObject != null) | ||
930 | { | ||
931 | sAgentCircuitData sag = new sAgentCircuitData(agentData); | ||
932 | //CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); | ||
933 | |||
934 | //// May need to change agent's name | ||
935 | //if (IsLocalUser(uinfo)) | ||
936 | //{ | ||
937 | // sag.firstname = agentData.firstname + "." + agentData.lastname; | ||
938 | // sag.lastname = serversInfo.UserURL; //HGNetworkServersInfo.Singleton.LocalUserServerURI; | ||
939 | //} | ||
940 | retValue = remObject.InformRegionOfChildAgent(regionHandle, sag); | ||
941 | } | ||
942 | else | ||
943 | { | ||
944 | m_log.Warn("[HGrid]: remoting object not found"); | ||
945 | } | ||
946 | remObject = null; | ||
947 | m_log.Info("[HGrid]: tried to InformRegionOfChildAgent for " + | ||
948 | agentData.firstname + " " + agentData.lastname + " and got " + | ||
949 | retValue.ToString()); | ||
950 | |||
951 | // Remove the info from this region | ||
952 | //if (m_knownRegions.ContainsKey(uinfo.UserProfile.ID)) | ||
953 | // m_knownRegions.Remove(uinfo.UserProfile.ID); | ||
954 | |||
955 | return retValue; | ||
956 | } | ||
957 | catch (RemotingException e) | ||
958 | { | ||
959 | //NoteDeadRegion(regionHandle); | ||
960 | |||
961 | m_log.WarnFormat( | ||
962 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
963 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
964 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
965 | |||
966 | return false; | ||
967 | } | ||
968 | catch (SocketException e) | ||
969 | { | ||
970 | //NoteDeadRegion(regionHandle); | ||
971 | |||
972 | m_log.WarnFormat( | ||
973 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
974 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
975 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
976 | |||
977 | return false; | ||
978 | } | ||
979 | catch (InvalidCredentialException e) | ||
980 | { | ||
981 | //NoteDeadRegion(regionHandle); | ||
982 | |||
983 | m_log.WarnFormat( | ||
984 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
985 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
986 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
987 | |||
988 | return false; | ||
989 | } | ||
990 | catch (AuthenticationException e) | ||
991 | { | ||
992 | //NoteDeadRegion(regionHandle); | ||
993 | |||
994 | m_log.WarnFormat( | ||
995 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
996 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
997 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
998 | |||
999 | return false; | ||
1000 | } | ||
1001 | catch (Exception e) | ||
1002 | { | ||
1003 | //NoteDeadRegion(regionHandle); | ||
1004 | |||
1005 | if (regInfo != null) | ||
1006 | { | ||
1007 | m_log.WarnFormat( | ||
1008 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
1009 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
1010 | } | ||
1011 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
1012 | |||
1013 | return false; | ||
1014 | } | ||
1015 | |||
1016 | |||
1017 | } | ||
1018 | |||
1019 | public virtual bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) { return false; } | ||
1020 | |||
1021 | public virtual bool RegionUp(SerializableRegionInfo region, ulong regionhandle) { | ||
1022 | |||
1023 | ulong realHandle = FindRegionHandle(regionhandle); | ||
1024 | |||
1025 | if (realHandle == regionhandle) // something wrong, not remote region | ||
1026 | return false; | ||
1027 | |||
1028 | SerializableRegionInfo regInfo = null; | ||
1029 | try | ||
1030 | { | ||
1031 | // You may ask why this is in here... | ||
1032 | // The region asking the grid services about itself.. | ||
1033 | // And, surprisingly, the reason is.. it doesn't know | ||
1034 | // it's own remoting port! How special. | ||
1035 | RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); | ||
1036 | |||
1037 | region = new SerializableRegionInfo(RequestNeighbourInfo(realHandle)); | ||
1038 | region.RemotingAddress = region.ExternalHostName; | ||
1039 | region.RemotingPort = NetworkServersInfo.RemotingListenerPort; | ||
1040 | region.HttpPort = serversInfo.HttpListenerPort; | ||
1041 | |||
1042 | regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle)); | ||
1043 | if (regInfo != null) | ||
1044 | { | ||
1045 | // If we're not trying to remote to ourselves. | ||
1046 | if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) | ||
1047 | { | ||
1048 | //don't want to be creating a new link to the remote instance every time like we are here | ||
1049 | bool retValue = false; | ||
1050 | |||
1051 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
1052 | typeof(OGS1InterRegionRemoting), | ||
1053 | "tcp://" + | ||
1054 | regInfo.RemotingAddress + | ||
1055 | ":" + regInfo.RemotingPort + | ||
1056 | "/InterRegions"); | ||
1057 | |||
1058 | if (remObject != null) | ||
1059 | { | ||
1060 | retValue = remObject.RegionUp(regiondata, realHandle); | ||
1061 | } | ||
1062 | else | ||
1063 | { | ||
1064 | m_log.Warn("[HGrid]: remoting object not found"); | ||
1065 | } | ||
1066 | remObject = null; | ||
1067 | |||
1068 | m_log.Info( | ||
1069 | "[HGrid]: tried to inform region I'm up"); | ||
1070 | |||
1071 | return retValue; | ||
1072 | } | ||
1073 | else | ||
1074 | { | ||
1075 | // We're trying to inform ourselves via remoting. | ||
1076 | // This is here because we're looping over the listeners before we get here. | ||
1077 | // Odd but it should work. | ||
1078 | return true; | ||
1079 | } | ||
1080 | } | ||
1081 | |||
1082 | return false; | ||
1083 | } | ||
1084 | catch (RemotingException e) | ||
1085 | { | ||
1086 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region using tcp://" + | ||
1087 | regInfo.RemotingAddress + | ||
1088 | ":" + regInfo.RemotingPort + | ||
1089 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
1090 | " - Is this neighbor up?"); | ||
1091 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
1092 | return false; | ||
1093 | } | ||
1094 | catch (SocketException e) | ||
1095 | { | ||
1096 | m_log.Warn("[HGrid]: Socket Error: Unable to connect to adjacent region using tcp://" + | ||
1097 | regInfo.RemotingAddress + | ||
1098 | ":" + regInfo.RemotingPort + | ||
1099 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
1100 | " - Is this neighbor up?"); | ||
1101 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
1102 | return false; | ||
1103 | } | ||
1104 | catch (InvalidCredentialException e) | ||
1105 | { | ||
1106 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | ||
1107 | regInfo.RemotingAddress + | ||
1108 | ":" + regInfo.RemotingPort + | ||
1109 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1110 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
1111 | return false; | ||
1112 | } | ||
1113 | catch (AuthenticationException e) | ||
1114 | { | ||
1115 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + | ||
1116 | regInfo.RemotingAddress + | ||
1117 | ":" + regInfo.RemotingPort + | ||
1118 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1119 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
1120 | return false; | ||
1121 | } | ||
1122 | catch (Exception e) | ||
1123 | { | ||
1124 | m_log.Debug(e.ToString()); | ||
1125 | return false; | ||
1126 | } | ||
1127 | |||
1128 | } | ||
1129 | |||
1130 | public virtual bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) { return false; } | ||
1131 | |||
1132 | public virtual List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
1133 | { | ||
1134 | return new List<UUID>(); | ||
1135 | } | ||
1136 | |||
1137 | public virtual bool TriggerTerminateFriend(ulong regionHandle, UUID agentID, UUID exFriendID) | ||
1138 | { | ||
1139 | return true; | ||
1140 | } | ||
1141 | |||
1142 | |||
1143 | #endregion | ||
1144 | 816 | ||
1145 | #region Methods triggered by calls from external instances | 817 | #region Methods triggered by calls from external instances |
1146 | 818 | ||
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs index 94646d2..85fb4b7 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesGridMode.cs | |||
@@ -71,9 +71,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
71 | : base(servers_info, httpServe, asscache, sman) | 71 | : base(servers_info, httpServe, asscache, sman) |
72 | { | 72 | { |
73 | m_remoteBackend = new OGS1GridServices(servers_info, httpServe); | 73 | m_remoteBackend = new OGS1GridServices(servers_info, httpServe); |
74 | // Let's deregister this, so we can handle it here first | ||
75 | InterRegionSingleton.Instance.OnChildAgent -= m_remoteBackend.IncomingChildAgent; | ||
76 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; | ||
77 | m_userProfileCache = userv; | 74 | m_userProfileCache = userv; |
78 | } | 75 | } |
79 | 76 | ||
@@ -158,125 +155,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
158 | 155 | ||
159 | #endregion | 156 | #endregion |
160 | 157 | ||
161 | #region IInterRegionCommunications interface | ||
162 | |||
163 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | ||
164 | { | ||
165 | return m_remoteBackend.AcknowledgeAgentCrossed(regionHandle, agentId); | ||
166 | } | ||
167 | |||
168 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) | ||
169 | { | ||
170 | return m_remoteBackend.AcknowledgePrimCrossed(regionHandle, primID); | ||
171 | } | ||
172 | |||
173 | public override bool CheckRegion(string address, uint port) | ||
174 | { | ||
175 | return m_remoteBackend.CheckRegion(address, port); | ||
176 | } | ||
177 | |||
178 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
179 | { | ||
180 | return m_remoteBackend.ChildAgentUpdate(regionHandle, cAgentData); | ||
181 | } | ||
182 | |||
183 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
184 | { | ||
185 | if (base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) | ||
186 | return true; | ||
187 | return m_remoteBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
188 | } | ||
189 | |||
190 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isFlying) | ||
191 | { | ||
192 | return m_remoteBackend.ExpectPrimCrossing(regionHandle, primID, position, isFlying); | ||
193 | } | ||
194 | |||
195 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
196 | { | ||
197 | CachedUserInfo user = m_userProfileCache.GetUserDetails(agentData.AgentID); | ||
198 | |||
199 | if (IsLocalUser(user)) | ||
200 | { | ||
201 | Console.WriteLine("XXX Home User XXX"); | ||
202 | if (IsHyperlinkRegion(regionHandle)) | ||
203 | { | ||
204 | Console.WriteLine("XXX Going Hyperlink XXX"); | ||
205 | return base.InformRegionOfChildAgent(regionHandle, agentData); | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | // non-hypergrid case | ||
210 | Console.WriteLine("XXX Going local-grid region XXX"); | ||
211 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | ||
212 | } | ||
213 | } | ||
214 | |||
215 | // Foregin users | ||
216 | Console.WriteLine("XXX Foreign User XXX"); | ||
217 | if (IsLocalRegion(regionHandle)) // regions on the same instance | ||
218 | { | ||
219 | Console.WriteLine("XXX Going onInstance region XXX"); | ||
220 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | ||
221 | } | ||
222 | |||
223 | if (IsHyperlinkRegion(regionHandle)) // hyperlinked regions | ||
224 | { | ||
225 | Console.WriteLine("XXX Going Hyperlink XXX"); | ||
226 | return base.InformRegionOfChildAgent(regionHandle, agentData); | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | // foreign user going to a non-local region on the same grid | ||
231 | // We need to inform that region about this user before | ||
232 | // proceeding to the normal backend process. | ||
233 | Console.WriteLine("XXX Going local-grid region XXX"); | ||
234 | RegionInfo regInfo = RequestNeighbourInfo(regionHandle); | ||
235 | if (regInfo != null) | ||
236 | // For now, don't test if this succeeds/fails; until someone complains, this is a feature :-) | ||
237 | InformRegionOfUser(regInfo, agentData); | ||
238 | return m_remoteBackend.InformRegionOfChildAgent(regionHandle, agentData); | ||
239 | } | ||
240 | |||
241 | } | ||
242 | |||
243 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
244 | { | ||
245 | return m_remoteBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod); | ||
246 | } | ||
247 | |||
248 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) | ||
249 | { | ||
250 | if (m_remoteBackend.RegionUp(region, regionhandle)) | ||
251 | return true; | ||
252 | return base.RegionUp(region, regionhandle); | ||
253 | } | ||
254 | |||
255 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
256 | { | ||
257 | return m_remoteBackend.TellRegionToCloseChildConnection(regionHandle, agentID); | ||
258 | } | ||
259 | |||
260 | |||
261 | #endregion | ||
262 | |||
263 | #region Methods triggered by calls from external instances | ||
264 | |||
265 | /// <summary> | ||
266 | /// | ||
267 | /// </summary> | ||
268 | /// <param name="regionHandle"></param> | ||
269 | /// <param name="agentData"></param> | ||
270 | /// <returns></returns> | ||
271 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
272 | { | ||
273 | AdjustUserInformation(agentData); | ||
274 | |||
275 | m_log.Info("[HGrid]: Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); | ||
276 | |||
277 | return m_remoteBackend.IncomingChildAgent(regionHandle, agentData); | ||
278 | } | ||
279 | #endregion | ||
280 | 158 | ||
281 | } | 159 | } |
282 | } | 160 | } |
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs index ea8ac2e..36d4b99 100644 --- a/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs +++ b/OpenSim/Region/Communications/Hypergrid/HGGridServicesStandalone.cs | |||
@@ -84,7 +84,6 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
84 | httpServer.AddXmlRPCHandler("check", PingCheckReply); | 84 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
85 | httpServer.AddXmlRPCHandler("land_data", LandData); | 85 | httpServer.AddXmlRPCHandler("land_data", LandData); |
86 | 86 | ||
87 | StartRemoting(); | ||
88 | } | 87 | } |
89 | 88 | ||
90 | #region IGridServices interface | 89 | #region IGridServices interface |
@@ -256,683 +255,5 @@ namespace OpenSim.Region.Communications.Hypergrid | |||
256 | 255 | ||
257 | #endregion | 256 | #endregion |
258 | 257 | ||
259 | #region Remoting | ||
260 | |||
261 | /// <summary> | ||
262 | /// Start listening for .net remoting calls from other regions. | ||
263 | /// </summary> | ||
264 | private void StartRemoting() | ||
265 | { | ||
266 | m_log.Info("[HGrid]: Start remoting..."); | ||
267 | TcpChannel ch; | ||
268 | try | ||
269 | { | ||
270 | ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); | ||
271 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this. | ||
272 | } | ||
273 | catch (Exception ex) | ||
274 | { | ||
275 | m_log.Error("[HGrid]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + "."); | ||
276 | throw (ex); | ||
277 | } | ||
278 | |||
279 | WellKnownServiceTypeEntry wellType = | ||
280 | new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", | ||
281 | WellKnownObjectMode.Singleton); | ||
282 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); | ||
283 | InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; | ||
284 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; | ||
285 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; | ||
286 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; | ||
287 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | ||
288 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; | ||
289 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; | ||
290 | } | ||
291 | |||
292 | |||
293 | #endregion | ||
294 | |||
295 | #region IInterRegionCommunications interface (Methods called by regions in this instance) | ||
296 | |||
297 | public override bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
298 | { | ||
299 | int failures = 0; | ||
300 | lock (m_deadRegionCache) | ||
301 | { | ||
302 | if (m_deadRegionCache.ContainsKey(regionHandle)) | ||
303 | { | ||
304 | failures = m_deadRegionCache[regionHandle]; | ||
305 | } | ||
306 | } | ||
307 | if (failures <= 3) | ||
308 | { | ||
309 | RegionInfo regInfo = null; | ||
310 | try | ||
311 | { | ||
312 | if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) | ||
313 | { | ||
314 | return true; | ||
315 | } | ||
316 | |||
317 | regInfo = RequestNeighbourInfo(regionHandle); | ||
318 | if (regInfo != null) | ||
319 | { | ||
320 | //don't want to be creating a new link to the remote instance every time like we are here | ||
321 | bool retValue = false; | ||
322 | |||
323 | |||
324 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
325 | typeof(OGS1InterRegionRemoting), | ||
326 | "tcp://" + regInfo.RemotingAddress + | ||
327 | ":" + regInfo.RemotingPort + | ||
328 | "/InterRegions"); | ||
329 | |||
330 | if (remObject != null) | ||
331 | { | ||
332 | retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); | ||
333 | } | ||
334 | else | ||
335 | { | ||
336 | m_log.Warn("[HGrid]: remoting object not found"); | ||
337 | } | ||
338 | remObject = null; | ||
339 | |||
340 | return retValue; | ||
341 | } | ||
342 | NoteDeadRegion(regionHandle); | ||
343 | |||
344 | return false; | ||
345 | } | ||
346 | catch (RemotingException e) | ||
347 | { | ||
348 | NoteDeadRegion(regionHandle); | ||
349 | |||
350 | m_log.WarnFormat( | ||
351 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
352 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
353 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
354 | |||
355 | return false; | ||
356 | } | ||
357 | catch (SocketException e) | ||
358 | { | ||
359 | NoteDeadRegion(regionHandle); | ||
360 | |||
361 | m_log.WarnFormat( | ||
362 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
363 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
364 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
365 | |||
366 | return false; | ||
367 | } | ||
368 | catch (InvalidCredentialException e) | ||
369 | { | ||
370 | NoteDeadRegion(regionHandle); | ||
371 | |||
372 | m_log.WarnFormat( | ||
373 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
374 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
375 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
376 | |||
377 | return false; | ||
378 | } | ||
379 | catch (AuthenticationException e) | ||
380 | { | ||
381 | NoteDeadRegion(regionHandle); | ||
382 | |||
383 | m_log.WarnFormat( | ||
384 | "[HGrid]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
385 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
386 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
387 | |||
388 | return false; | ||
389 | } | ||
390 | catch (Exception e) | ||
391 | { | ||
392 | NoteDeadRegion(regionHandle); | ||
393 | |||
394 | m_log.WarnFormat("[HGrid]: Unable to connect to adjacent region: {0} {1},{2}", | ||
395 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
396 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
397 | |||
398 | return false; | ||
399 | } | ||
400 | } | ||
401 | else | ||
402 | { | ||
403 | //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); | ||
404 | return false; | ||
405 | } | ||
406 | } | ||
407 | |||
408 | /// <summary> | ||
409 | /// Inform a region that a child agent will be on the way from a client. | ||
410 | /// </summary> | ||
411 | /// <param name="regionHandle"></param> | ||
412 | /// <param name="agentData"></param> | ||
413 | /// <returns></returns> | ||
414 | public override bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
415 | { | ||
416 | |||
417 | if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) | ||
418 | { | ||
419 | return true; | ||
420 | } | ||
421 | return base.InformRegionOfChildAgent(regionHandle, agentData); | ||
422 | } | ||
423 | |||
424 | // UGLY! | ||
425 | public override bool RegionUp(SerializableRegionInfo region, ulong regionhandle) | ||
426 | { | ||
427 | if (m_localBackend.RegionUp(region, regionhandle)) | ||
428 | return true; | ||
429 | return base.RegionUp(region, regionhandle); | ||
430 | } | ||
431 | |||
432 | /// <summary> | ||
433 | /// | ||
434 | /// </summary> | ||
435 | /// <param name="regionHandle"></param> | ||
436 | /// <param name="agentData"></param> | ||
437 | /// <returns></returns> | ||
438 | public override bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
439 | { | ||
440 | int failures = 0; | ||
441 | lock (m_deadRegionCache) | ||
442 | { | ||
443 | if (m_deadRegionCache.ContainsKey(regionHandle)) | ||
444 | { | ||
445 | failures = m_deadRegionCache[regionHandle]; | ||
446 | } | ||
447 | } | ||
448 | if (failures <= 1) | ||
449 | { | ||
450 | RegionInfo regInfo = null; | ||
451 | try | ||
452 | { | ||
453 | if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod)) | ||
454 | { | ||
455 | return true; | ||
456 | } | ||
457 | |||
458 | regInfo = RequestNeighbourInfo(regionHandle); | ||
459 | if (regInfo != null) | ||
460 | { | ||
461 | try | ||
462 | { | ||
463 | regionHandle = Convert.ToUInt64(regInfo.regionSecret); | ||
464 | } | ||
465 | catch (Exception) | ||
466 | { | ||
467 | m_log.Warn("[HGrid]: Invalid hyperlink region."); | ||
468 | return false; | ||
469 | } | ||
470 | |||
471 | //don't want to be creating a new link to the remote instance every time like we are here | ||
472 | bool retValue = false; | ||
473 | |||
474 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
475 | typeof(OGS1InterRegionRemoting), | ||
476 | "tcp://" + regInfo.RemotingAddress + | ||
477 | ":" + regInfo.RemotingPort + | ||
478 | "/InterRegions"); | ||
479 | |||
480 | if (remObject != null) | ||
481 | { | ||
482 | m_log.Debug("[HGrid]: Inform region of prim crossing: " + regInfo.RemotingAddress + ":" + regInfo.RemotingPort); | ||
483 | retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod); | ||
484 | } | ||
485 | else | ||
486 | { | ||
487 | m_log.Warn("[HGrid]: Remoting object not found"); | ||
488 | } | ||
489 | remObject = null; | ||
490 | |||
491 | return retValue; | ||
492 | } | ||
493 | NoteDeadRegion(regionHandle); | ||
494 | return false; | ||
495 | } | ||
496 | catch (RemotingException e) | ||
497 | { | ||
498 | NoteDeadRegion(regionHandle); | ||
499 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
500 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
501 | return false; | ||
502 | } | ||
503 | catch (SocketException e) | ||
504 | { | ||
505 | NoteDeadRegion(regionHandle); | ||
506 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
507 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
508 | return false; | ||
509 | } | ||
510 | catch (InvalidCredentialException e) | ||
511 | { | ||
512 | NoteDeadRegion(regionHandle); | ||
513 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | ||
514 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
515 | return false; | ||
516 | } | ||
517 | catch (AuthenticationException e) | ||
518 | { | ||
519 | NoteDeadRegion(regionHandle); | ||
520 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | ||
521 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
522 | return false; | ||
523 | } | ||
524 | catch (Exception e) | ||
525 | { | ||
526 | NoteDeadRegion(regionHandle); | ||
527 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | ||
528 | m_log.DebugFormat("[HGrid]: {0}", e); | ||
529 | return false; | ||
530 | } | ||
531 | } | ||
532 | else | ||
533 | { | ||
534 | return false; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | /// <summary> | ||
539 | /// | ||
540 | /// </summary> | ||
541 | /// <param name="regionHandle"></param> | ||
542 | /// <param name="agentID"></param> | ||
543 | /// <param name="position"></param> | ||
544 | /// <returns></returns> | ||
545 | public override bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
546 | { | ||
547 | |||
548 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); | ||
549 | bool banned = false; | ||
550 | bool localregion = false; | ||
551 | |||
552 | for (int i = 0; i < regions.Length; i++) | ||
553 | { | ||
554 | if (regions[i] != null) | ||
555 | { | ||
556 | if (regions[i].RegionHandle == regionHandle) | ||
557 | { | ||
558 | localregion = true; | ||
559 | if (regions[i].EstateSettings.IsBanned(agentID)) | ||
560 | { | ||
561 | banned = true; | ||
562 | break; | ||
563 | } | ||
564 | } | ||
565 | } | ||
566 | } | ||
567 | |||
568 | if (banned) | ||
569 | return false; | ||
570 | if (localregion) | ||
571 | return m_localBackend.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
572 | |||
573 | return base.ExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
574 | |||
575 | } | ||
576 | |||
577 | public override bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | ||
578 | { | ||
579 | RegionInfo regInfo = null; | ||
580 | try | ||
581 | { | ||
582 | if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) | ||
583 | { | ||
584 | return true; | ||
585 | } | ||
586 | |||
587 | regInfo = RequestNeighbourInfo(regionHandle); | ||
588 | if (regInfo != null) | ||
589 | { | ||
590 | bool retValue = false; | ||
591 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
592 | typeof(OGS1InterRegionRemoting), | ||
593 | "tcp://" + regInfo.RemotingAddress + | ||
594 | ":" + regInfo.RemotingPort + | ||
595 | "/InterRegions"); | ||
596 | |||
597 | if (remObject != null) | ||
598 | { | ||
599 | retValue = | ||
600 | remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position), | ||
601 | isPhysical); | ||
602 | } | ||
603 | else | ||
604 | { | ||
605 | m_log.Warn("[HGrid]: Remoting object not found"); | ||
606 | } | ||
607 | remObject = null; | ||
608 | |||
609 | return retValue; | ||
610 | } | ||
611 | //TODO need to see if we know about where this region is and use .net remoting | ||
612 | // to inform it. | ||
613 | NoteDeadRegion(regionHandle); | ||
614 | return false; | ||
615 | } | ||
616 | catch (RemotingException e) | ||
617 | { | ||
618 | NoteDeadRegion(regionHandle); | ||
619 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
620 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
621 | return false; | ||
622 | } | ||
623 | catch (SocketException e) | ||
624 | { | ||
625 | NoteDeadRegion(regionHandle); | ||
626 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
627 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
628 | return false; | ||
629 | } | ||
630 | catch (InvalidCredentialException e) | ||
631 | { | ||
632 | NoteDeadRegion(regionHandle); | ||
633 | m_log.Warn("[HGrid]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | ||
634 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
635 | return false; | ||
636 | } | ||
637 | catch (AuthenticationException e) | ||
638 | { | ||
639 | NoteDeadRegion(regionHandle); | ||
640 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | ||
641 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
642 | return false; | ||
643 | } | ||
644 | catch (Exception e) | ||
645 | { | ||
646 | NoteDeadRegion(regionHandle); | ||
647 | m_log.Warn("[HGrid]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | ||
648 | m_log.DebugFormat("[HGrid]: {0}", e); | ||
649 | return false; | ||
650 | } | ||
651 | } | ||
652 | |||
653 | public override bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
654 | { | ||
655 | m_log.Debug("[HGrid]: TellRegion " + regionHandle + " ToCloseChildConnection for " + agentID); | ||
656 | RegionInfo regInfo = null; | ||
657 | try | ||
658 | { | ||
659 | if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) | ||
660 | { | ||
661 | return true; | ||
662 | } | ||
663 | |||
664 | regInfo = RequestNeighbourInfo(regionHandle); | ||
665 | if (regInfo != null) | ||
666 | { | ||
667 | // bool retValue = false; | ||
668 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
669 | typeof(OGS1InterRegionRemoting), | ||
670 | "tcp://" + regInfo.RemotingAddress + | ||
671 | ":" + regInfo.RemotingPort + | ||
672 | "/InterRegions"); | ||
673 | |||
674 | if (remObject != null) | ||
675 | { | ||
676 | // retValue = | ||
677 | remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid); | ||
678 | } | ||
679 | else | ||
680 | { | ||
681 | m_log.Warn("[HGrid]: Remoting object not found"); | ||
682 | } | ||
683 | remObject = null; | ||
684 | |||
685 | return true; | ||
686 | } | ||
687 | //TODO need to see if we know about where this region is and use .net remoting | ||
688 | // to inform it. | ||
689 | NoteDeadRegion(regionHandle); | ||
690 | return false; | ||
691 | } | ||
692 | catch (RemotingException) | ||
693 | { | ||
694 | NoteDeadRegion(regionHandle); | ||
695 | m_log.Warn("[HGrid]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + | ||
696 | " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
697 | //m_log.Debug(e.ToString()); | ||
698 | return false; | ||
699 | } | ||
700 | catch (SocketException e) | ||
701 | { | ||
702 | NoteDeadRegion(regionHandle); | ||
703 | m_log.Warn("[HGridS]: Socket Error: Unable to connect to adjacent region using tcp://" + | ||
704 | regInfo.RemotingAddress + | ||
705 | ":" + regInfo.RemotingPort + | ||
706 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
707 | " - Is this neighbor up?"); | ||
708 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
709 | return false; | ||
710 | } | ||
711 | catch (InvalidCredentialException e) | ||
712 | { | ||
713 | NoteDeadRegion(regionHandle); | ||
714 | m_log.Warn("[HGrid]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | ||
715 | regInfo.RemotingAddress + | ||
716 | ":" + regInfo.RemotingPort + | ||
717 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
718 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
719 | return false; | ||
720 | } | ||
721 | catch (AuthenticationException e) | ||
722 | { | ||
723 | NoteDeadRegion(regionHandle); | ||
724 | m_log.Warn("[HGrid]: Authentication exception: Unable to connect to adjacent region using tcp://" + | ||
725 | regInfo.RemotingAddress + | ||
726 | ":" + regInfo.RemotingPort + | ||
727 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
728 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
729 | return false; | ||
730 | } | ||
731 | catch (WebException e) | ||
732 | { | ||
733 | NoteDeadRegion(regionHandle); | ||
734 | m_log.Warn("[HGrid]: WebException exception: Unable to connect to adjacent region using tcp://" + | ||
735 | regInfo.RemotingAddress + | ||
736 | ":" + regInfo.RemotingPort + | ||
737 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
738 | m_log.DebugFormat("[HGrid]: {0} {1}", e.Source, e.Message); | ||
739 | return false; | ||
740 | } | ||
741 | catch (Exception e) | ||
742 | { | ||
743 | NoteDeadRegion(regionHandle); | ||
744 | // This line errors with a Null Reference Exception.. Why? @.@ | ||
745 | //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + | ||
746 | // ":" + regInfo.RemotingPort + | ||
747 | //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); | ||
748 | m_log.DebugFormat("[HGrid]: {0}", e); | ||
749 | return false; | ||
750 | } | ||
751 | } | ||
752 | |||
753 | public override bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | ||
754 | { | ||
755 | return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); | ||
756 | } | ||
757 | |||
758 | public override bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId) | ||
759 | { | ||
760 | return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); | ||
761 | } | ||
762 | |||
763 | #endregion | ||
764 | |||
765 | #region Methods triggered by calls from external instances | ||
766 | |||
767 | /// <summary> | ||
768 | /// | ||
769 | /// </summary> | ||
770 | /// <param name="regionHandle"></param> | ||
771 | /// <param name="agentData"></param> | ||
772 | /// <returns></returns> | ||
773 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
774 | { | ||
775 | AdjustUserInformation(agentData); | ||
776 | |||
777 | m_log.Info("[HGrid]: " + gdebugRegionName + ": Incoming HGrid Agent " + agentData.firstname + " " + agentData.lastname); | ||
778 | |||
779 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); | ||
780 | } | ||
781 | |||
782 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) | ||
783 | { | ||
784 | m_log.Info( | ||
785 | "[HGrid]: " + | ||
786 | m_localBackend._gdebugRegionName + "Incoming HGrid RegionUpReport: " + "(" + regionData.X + | ||
787 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); | ||
788 | |||
789 | RegionInfo nRegionInfo = new RegionInfo(); | ||
790 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); | ||
791 | nRegionInfo.ExternalHostName = regionData.IPADDR; | ||
792 | nRegionInfo.RegionLocX = regionData.X; | ||
793 | nRegionInfo.RegionLocY = regionData.Y; | ||
794 | |||
795 | lock (m_deadRegionCache) | ||
796 | { | ||
797 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) | ||
798 | { | ||
799 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); | ||
800 | } | ||
801 | } | ||
802 | |||
803 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); | ||
804 | } | ||
805 | |||
806 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
807 | { | ||
808 | //m_log.Info("[INTER]: Incoming HGrid Child Agent Data Update"); | ||
809 | |||
810 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); | ||
811 | } | ||
812 | |||
813 | /// <summary> | ||
814 | /// | ||
815 | /// </summary> | ||
816 | /// <param name="regionHandle"></param> | ||
817 | /// <param name="agentData"></param> | ||
818 | /// <returns></returns> | ||
819 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
820 | { | ||
821 | m_log.Debug("[HGrid]: Incoming Prim"); | ||
822 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); | ||
823 | |||
824 | return true; | ||
825 | } | ||
826 | |||
827 | /// <summary> | ||
828 | /// | ||
829 | /// </summary> | ||
830 | /// <param name="regionHandle"></param> | ||
831 | /// <param name="agentID"></param> | ||
832 | /// <param name="position"></param> | ||
833 | /// <returns></returns> | ||
834 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
835 | { | ||
836 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
837 | } | ||
838 | |||
839 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | ||
840 | { | ||
841 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); | ||
842 | } | ||
843 | |||
844 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
845 | { | ||
846 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
847 | } | ||
848 | |||
849 | int timeOut = 10; //10 seconds | ||
850 | /// <summary> | ||
851 | /// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions. | ||
852 | /// </summary> | ||
853 | /// <param name="address"></param> | ||
854 | /// <param name="port"></param> | ||
855 | /// <param name="retry"></param> | ||
856 | /// <returns></returns> | ||
857 | public bool CheckRegion(string address, uint port, bool retry) | ||
858 | { | ||
859 | bool available = false; | ||
860 | bool timed_out = true; | ||
861 | |||
862 | IPAddress ia; | ||
863 | IPAddress.TryParse(address, out ia); | ||
864 | IPEndPoint m_EndPoint = new IPEndPoint(ia, (int)port); | ||
865 | |||
866 | AsyncCallback callback = delegate(IAsyncResult iar) | ||
867 | { | ||
868 | Socket s = (Socket)iar.AsyncState; | ||
869 | try | ||
870 | { | ||
871 | s.EndConnect(iar); | ||
872 | available = true; | ||
873 | timed_out = false; | ||
874 | } | ||
875 | catch (Exception e) | ||
876 | { | ||
877 | m_log.DebugFormat( | ||
878 | "[HGrid]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace); | ||
879 | } | ||
880 | |||
881 | s.Close(); | ||
882 | }; | ||
883 | |||
884 | try | ||
885 | { | ||
886 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | ||
887 | IAsyncResult ar = socket.BeginConnect(m_EndPoint, callback, socket); | ||
888 | ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false); | ||
889 | } | ||
890 | catch (Exception e) | ||
891 | { | ||
892 | m_log.DebugFormat( | ||
893 | "[HGrid]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace); | ||
894 | |||
895 | return false; | ||
896 | } | ||
897 | |||
898 | if (timed_out) | ||
899 | { | ||
900 | m_log.DebugFormat( | ||
901 | "[HGrid]: socket [{0}] timed out ({1}) waiting to obtain a connection.", | ||
902 | m_EndPoint, timeOut * 1000); | ||
903 | |||
904 | if (retry) | ||
905 | { | ||
906 | return CheckRegion(address, port, false); | ||
907 | } | ||
908 | } | ||
909 | |||
910 | return available; | ||
911 | } | ||
912 | |||
913 | public override bool CheckRegion(string address, uint port) | ||
914 | { | ||
915 | return CheckRegion(address, port, true); | ||
916 | } | ||
917 | |||
918 | public void NoteDeadRegion(ulong regionhandle) | ||
919 | { | ||
920 | lock (m_deadRegionCache) | ||
921 | { | ||
922 | if (m_deadRegionCache.ContainsKey(regionhandle)) | ||
923 | { | ||
924 | m_deadRegionCache[regionhandle] = m_deadRegionCache[regionhandle] + 1; | ||
925 | } | ||
926 | else | ||
927 | { | ||
928 | m_deadRegionCache.Add(regionhandle, 1); | ||
929 | } | ||
930 | } | ||
931 | |||
932 | } | ||
933 | |||
934 | #endregion | ||
935 | |||
936 | |||
937 | } | 258 | } |
938 | } | 259 | } |
diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index 3a5c33e..59a1293 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Communications.Local | |||
41 | IUserService userService, | 41 | IUserService userService, |
42 | IUserAdminService userServiceAdmin, | 42 | IUserAdminService userServiceAdmin, |
43 | LocalInventoryService inventoryService, | 43 | LocalInventoryService inventoryService, |
44 | IInterRegionCommunications interRegionService, | ||
45 | IGridServices gridService, IMessagingService messageService, | 44 | IGridServices gridService, IMessagingService messageService, |
46 | LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) | 45 | LibraryRootFolder libraryRootFolder, bool dumpAssetsToFile) |
47 | : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder) | 46 | : base(serversInfo, httpServer, assetCache, dumpAssetsToFile, libraryRootFolder) |
@@ -53,7 +52,6 @@ namespace OpenSim.Region.Communications.Local | |||
53 | m_userAdminService = userServiceAdmin; | 52 | m_userAdminService = userServiceAdmin; |
54 | m_avatarService = (IAvatarService)userService; | 53 | m_avatarService = (IAvatarService)userService; |
55 | m_gridService = gridService; | 54 | m_gridService = gridService; |
56 | m_interRegion = interRegionService; | ||
57 | m_messageService = messageService; | 55 | m_messageService = messageService; |
58 | } | 56 | } |
59 | } | 57 | } |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index fc2f422..306ea27 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -36,7 +36,7 @@ using OpenSim.Framework.Communications; | |||
36 | 36 | ||
37 | namespace OpenSim.Region.Communications.Local | 37 | namespace OpenSim.Region.Communications.Local |
38 | { | 38 | { |
39 | public class LocalBackEndServices : IGridServices, IInterRegionCommunications | 39 | public class LocalBackEndServices : IGridServices |
40 | { | 40 | { |
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
@@ -244,46 +244,6 @@ namespace OpenSim.Region.Communications.Local | |||
244 | return mapBlocks; | 244 | return mapBlocks; |
245 | } | 245 | } |
246 | 246 | ||
247 | public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
248 | { | ||
249 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
250 | { | ||
251 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID); | ||
252 | } | ||
253 | |||
254 | return false; | ||
255 | } | ||
256 | |||
257 | public virtual bool RegionUp(SerializableRegionInfo sregion, ulong regionhandle) | ||
258 | { | ||
259 | RegionInfo region = new RegionInfo(sregion); | ||
260 | |||
261 | //region.RegionLocX = sregion.X; | ||
262 | //region.RegionLocY = sregion.Y; | ||
263 | //region.SetEndPoint(sregion.IPADDR, sregion.PORT); | ||
264 | |||
265 | //sregion); | ||
266 | if (m_regionListeners.ContainsKey(regionhandle)) | ||
267 | { | ||
268 | return m_regionListeners[regionhandle].TriggerRegionUp(region); | ||
269 | } | ||
270 | |||
271 | return false; | ||
272 | } | ||
273 | |||
274 | public virtual bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
275 | { | ||
276 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
277 | { | ||
278 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
279 | m_regionListeners[regionHandle].TriggerChildAgentUpdate(cAgentData); | ||
280 | //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); | ||
281 | |||
282 | return true; | ||
283 | } | ||
284 | return false; | ||
285 | } | ||
286 | |||
287 | // This function is only here to keep this class in line with the Grid Interface. | 247 | // This function is only here to keep this class in line with the Grid Interface. |
288 | // It never gets called. | 248 | // It never gets called. |
289 | public virtual Dictionary<string, string> GetGridSettings() | 249 | public virtual Dictionary<string, string> GetGridSettings() |
@@ -303,124 +263,6 @@ namespace OpenSim.Region.Communications.Local | |||
303 | m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); | 263 | m_queuedGridSettings.Add("allow_forceful_banlines", "FALSE"); |
304 | } | 264 | } |
305 | 265 | ||
306 | public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) | ||
307 | { | ||
308 | if (m_regionListeners.ContainsKey(regionhandle)) | ||
309 | { | ||
310 | return m_regionListeners[regionhandle].TriggerRegionUp(region); | ||
311 | } | ||
312 | |||
313 | return false; | ||
314 | } | ||
315 | |||
316 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
317 | { | ||
318 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
319 | { | ||
320 | return m_regionListeners[regionHandle].TriggerChildAgentUpdate(cAgentData); | ||
321 | } | ||
322 | |||
323 | return false; | ||
324 | } | ||
325 | |||
326 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
327 | { | ||
328 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
329 | { | ||
330 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID); | ||
331 | } | ||
332 | |||
333 | return false; | ||
334 | } | ||
335 | |||
336 | /// <summary> | ||
337 | /// Tell a region to expect a new client connection. | ||
338 | /// </summary> | ||
339 | /// <param name="regionHandle"></param> | ||
340 | /// <param name="agentData"></param> | ||
341 | /// <returns></returns> | ||
342 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
343 | // TODO: should change from agentCircuitData | ||
344 | { | ||
345 | //Console.WriteLine("CommsManager- Trying to Inform a region to expect child agent"); | ||
346 | //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Trying to inform region of child agent: " + agentData.firstname + " " + agentData.lastname); | ||
347 | |||
348 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
349 | { | ||
350 | // Console.WriteLine("CommsManager- Informing a region to expect child agent"); | ||
351 | m_regionListeners[regionHandle].TriggerExpectUser(agentData); | ||
352 | //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Got Listener trigginering local event: " + agentData.firstname + " " + agentData.lastname); | ||
353 | |||
354 | return true; | ||
355 | } | ||
356 | return false; | ||
357 | } | ||
358 | |||
359 | /// <summary> | ||
360 | /// Tell a region to expect the crossing in of a new prim. | ||
361 | /// </summary> | ||
362 | /// <param name="regionHandle"></param> | ||
363 | /// <param name="primID"></param> | ||
364 | /// <param name="objData"></param> | ||
365 | /// <param name="XMLMethod"></param> | ||
366 | /// <returns></returns> | ||
367 | public bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
368 | { | ||
369 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
370 | { | ||
371 | m_regionListeners[regionHandle].TriggerExpectPrim(primID, objData, XMLMethod); | ||
372 | return true; | ||
373 | } | ||
374 | |||
375 | return false; | ||
376 | } | ||
377 | |||
378 | /// <summary> | ||
379 | /// Tell a region to get prepare for an avatar to cross into it. | ||
380 | /// </summary> | ||
381 | /// <param name="regionHandle"></param> | ||
382 | /// <param name="agentID"></param> | ||
383 | /// <param name="position"></param> | ||
384 | /// <returns></returns> | ||
385 | public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
386 | { | ||
387 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
388 | { | ||
389 | // Console.WriteLine("CommsManager- Informing a region to expect avatar crossing"); | ||
390 | m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(agentID, position, isFlying); | ||
391 | return true; | ||
392 | } | ||
393 | return false; | ||
394 | } | ||
395 | |||
396 | public bool ExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical) | ||
397 | { | ||
398 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
399 | { | ||
400 | m_regionListeners[regionHandle].TriggerExpectPrimCrossing(primID, position, isPhysical); | ||
401 | return true; | ||
402 | } | ||
403 | |||
404 | return false; | ||
405 | } | ||
406 | |||
407 | public bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | ||
408 | { | ||
409 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
410 | { | ||
411 | return true; | ||
412 | } | ||
413 | return false; | ||
414 | } | ||
415 | |||
416 | public bool AcknowledgePrimCrossed(ulong regionHandle, UUID primID) | ||
417 | { | ||
418 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
419 | { | ||
420 | return true; | ||
421 | } | ||
422 | return false; | ||
423 | } | ||
424 | 266 | ||
425 | /// <summary> | 267 | /// <summary> |
426 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session | 268 | /// Is a Sandbox mode method, used by the local Login server to inform a region of a connection user/session |
@@ -474,14 +316,6 @@ namespace OpenSim.Region.Communications.Local | |||
474 | } | 316 | } |
475 | } | 317 | } |
476 | 318 | ||
477 | public void TriggerExpectPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
478 | { | ||
479 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
480 | { | ||
481 | m_regionListeners[regionHandle].TriggerExpectPrim(primID, objData, XMLMethod); | ||
482 | } | ||
483 | } | ||
484 | |||
485 | public void PingCheckReply(Hashtable respData) | 319 | public void PingCheckReply(Hashtable respData) |
486 | { | 320 | { |
487 | foreach (ulong region in m_regions.Keys) | 321 | foreach (ulong region in m_regions.Keys) |
@@ -495,40 +329,6 @@ namespace OpenSim.Region.Communications.Local | |||
495 | } | 329 | } |
496 | } | 330 | } |
497 | 331 | ||
498 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
499 | { | ||
500 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
501 | { | ||
502 | return m_regionListeners[regionHandle].TriggerExpectAvatarCrossing(agentID, position, isFlying); | ||
503 | } | ||
504 | |||
505 | return false; | ||
506 | } | ||
507 | |||
508 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical) | ||
509 | { | ||
510 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
511 | { | ||
512 | return | ||
513 | m_regionListeners[regionHandle].TriggerExpectPrimCrossing(primID, position, isPhysical); | ||
514 | } | ||
515 | return false; | ||
516 | } | ||
517 | |||
518 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
519 | { | ||
520 | // m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: Other local region is sending child agent our way: " + agentData.firstname + " " + agentData.lastname); | ||
521 | |||
522 | if (m_regionListeners.ContainsKey(regionHandle)) | ||
523 | { | ||
524 | //m_log.Info("[INTER]: " + rdebugRegionName + ":Local BackEnd: found local region to trigger event on: " + agentData.firstname + " " + agentData.lastname); | ||
525 | |||
526 | TriggerExpectUser(regionHandle, agentData); | ||
527 | return true; | ||
528 | } | ||
529 | |||
530 | return false; | ||
531 | } | ||
532 | 332 | ||
533 | public LandData RequestLandData (ulong regionHandle, uint x, uint y) | 333 | public LandData RequestLandData (ulong regionHandle, uint x, uint y) |
534 | { | 334 | { |
@@ -560,20 +360,5 @@ namespace OpenSim.Region.Communications.Local | |||
560 | return regions; | 360 | return regions; |
561 | } | 361 | } |
562 | 362 | ||
563 | public List<UUID> InformFriendsInOtherRegion(UUID agentId, ulong destRegionHandle, List<UUID> friends, bool online) | ||
564 | { | ||
565 | // if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server? | ||
566 | m_log.WarnFormat("[INTERREGION STANDALONE] Did find {0} users on a region not on our server: {1} ???", | ||
567 | friends.Count, destRegionHandle); | ||
568 | return new List<UUID>(); | ||
569 | } | ||
570 | |||
571 | public bool TriggerTerminateFriend (ulong regionHandle, UUID agentID, UUID exFriendID) | ||
572 | { | ||
573 | // if we get to here, something is wrong: We are in standalone mode, but have users that are not on our server? | ||
574 | m_log.WarnFormat("[INTERREGION STANDALONE] Did find user {0} on a region not on our server: {1} ???", | ||
575 | agentID, regionHandle); | ||
576 | return true; | ||
577 | } | ||
578 | } | 363 | } |
579 | } | 364 | } |
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index c506dd0..f32b160 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
41 | { | 41 | { |
42 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); | 42 | OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); |
43 | m_gridService = gridInterComms; | 43 | m_gridService = gridInterComms; |
44 | m_interRegion = gridInterComms; | ||
45 | 44 | ||
46 | if (serversInfo.secureInventoryServer) | 45 | if (serversInfo.secureInventoryServer) |
47 | { | 46 | { |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 660e684..66da986 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -31,9 +31,6 @@ using System.Collections.Generic; | |||
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Sockets; | 32 | using System.Net.Sockets; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Runtime.Remoting; | ||
35 | using System.Runtime.Remoting.Channels; | ||
36 | using System.Runtime.Remoting.Channels.Tcp; | ||
37 | using System.Security.Authentication; | 34 | using System.Security.Authentication; |
38 | using log4net; | 35 | using log4net; |
39 | using Nwc.XmlRpc; | 36 | using Nwc.XmlRpc; |
@@ -45,7 +42,7 @@ using OpenSim.Region.Communications.Local; | |||
45 | 42 | ||
46 | namespace OpenSim.Region.Communications.OGS1 | 43 | namespace OpenSim.Region.Communications.OGS1 |
47 | { | 44 | { |
48 | public class OGS1GridServices : IGridServices, IInterRegionCommunications | 45 | public class OGS1GridServices : IGridServices |
49 | { | 46 | { |
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 48 | ||
@@ -99,7 +96,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
99 | httpServer.AddXmlRPCHandler("check", PingCheckReply); | 96 | httpServer.AddXmlRPCHandler("check", PingCheckReply); |
100 | httpServer.AddXmlRPCHandler("land_data", LandData); | 97 | httpServer.AddXmlRPCHandler("land_data", LandData); |
101 | 98 | ||
102 | StartRemoting(); | ||
103 | } | 99 | } |
104 | 100 | ||
105 | // see IGridServices | 101 | // see IGridServices |
@@ -716,913 +712,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
716 | return new XmlRpcResponse(); | 712 | return new XmlRpcResponse(); |
717 | } | 713 | } |
718 | 714 | ||
719 | #region m_interRegion Comms | ||
720 | |||
721 | /// <summary> | ||
722 | /// Start listening for .net remoting calls from other regions. | ||
723 | /// </summary> | ||
724 | private void StartRemoting() | ||
725 | { | ||
726 | TcpChannel ch; | ||
727 | try | ||
728 | { | ||
729 | ch = new TcpChannel((int)NetworkServersInfo.RemotingListenerPort); | ||
730 | ChannelServices.RegisterChannel(ch, false); // Disabled security as Mono doesn't support this. | ||
731 | } | ||
732 | catch (Exception ex) | ||
733 | { | ||
734 | m_log.Error("[OGS1 GRID SERVICES]: Exception while attempting to listen on TCP port " + (int)NetworkServersInfo.RemotingListenerPort + "."); | ||
735 | throw (ex); | ||
736 | } | ||
737 | |||
738 | WellKnownServiceTypeEntry wellType = | ||
739 | new WellKnownServiceTypeEntry(typeof (OGS1InterRegionRemoting), "InterRegions", | ||
740 | WellKnownObjectMode.Singleton); | ||
741 | RemotingConfiguration.RegisterWellKnownServiceType(wellType); | ||
742 | InterRegionSingleton.Instance.OnArrival += TriggerExpectAvatarCrossing; | ||
743 | InterRegionSingleton.Instance.OnChildAgent += IncomingChildAgent; | ||
744 | InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; | ||
745 | InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; | ||
746 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | ||
747 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; | ||
748 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; | ||
749 | } | ||
750 | |||
751 | #region Methods called by regions in this instance | ||
752 | |||
753 | public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
754 | { | ||
755 | int failures = 0; | ||
756 | lock (m_deadRegionCache) | ||
757 | { | ||
758 | if (m_deadRegionCache.ContainsKey(regionHandle)) | ||
759 | { | ||
760 | failures = m_deadRegionCache[regionHandle]; | ||
761 | } | ||
762 | } | ||
763 | if (failures <= 3) | ||
764 | { | ||
765 | RegionInfo regInfo = null; | ||
766 | try | ||
767 | { | ||
768 | if (m_localBackend.ChildAgentUpdate(regionHandle, cAgentData)) | ||
769 | { | ||
770 | return true; | ||
771 | } | ||
772 | |||
773 | regInfo = RequestNeighbourInfo(regionHandle); | ||
774 | if (regInfo != null) | ||
775 | { | ||
776 | //don't want to be creating a new link to the remote instance every time like we are here | ||
777 | bool retValue = false; | ||
778 | |||
779 | |||
780 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
781 | typeof(OGS1InterRegionRemoting), | ||
782 | "tcp://" + regInfo.RemotingAddress + | ||
783 | ":" + regInfo.RemotingPort + | ||
784 | "/InterRegions"); | ||
785 | |||
786 | if (remObject != null) | ||
787 | { | ||
788 | retValue = remObject.ChildAgentUpdate(regionHandle, cAgentData); | ||
789 | } | ||
790 | else | ||
791 | { | ||
792 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); | ||
793 | } | ||
794 | remObject = null; | ||
795 | // m_log.Info("[INTER]: " + | ||
796 | // gdebugRegionName + | ||
797 | // ": OGS1 tried to Update Child Agent data on outside region and got " + | ||
798 | // retValue.ToString()); | ||
799 | |||
800 | return retValue; | ||
801 | } | ||
802 | NoteDeadRegion(regionHandle); | ||
803 | |||
804 | return false; | ||
805 | } | ||
806 | catch (RemotingException e) | ||
807 | { | ||
808 | NoteDeadRegion(regionHandle); | ||
809 | |||
810 | m_log.WarnFormat( | ||
811 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
812 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
813 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
814 | |||
815 | return false; | ||
816 | } | ||
817 | catch (SocketException e) | ||
818 | { | ||
819 | NoteDeadRegion(regionHandle); | ||
820 | |||
821 | m_log.WarnFormat( | ||
822 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
823 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
824 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
825 | |||
826 | return false; | ||
827 | } | ||
828 | catch (InvalidCredentialException e) | ||
829 | { | ||
830 | NoteDeadRegion(regionHandle); | ||
831 | |||
832 | m_log.WarnFormat( | ||
833 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
834 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
835 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
836 | |||
837 | return false; | ||
838 | } | ||
839 | catch (AuthenticationException e) | ||
840 | { | ||
841 | NoteDeadRegion(regionHandle); | ||
842 | |||
843 | m_log.WarnFormat( | ||
844 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
845 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
846 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
847 | |||
848 | return false; | ||
849 | } | ||
850 | catch (Exception e) | ||
851 | { | ||
852 | NoteDeadRegion(regionHandle); | ||
853 | |||
854 | m_log.WarnFormat("[OGS1 GRID SERVICES]: Unable to connect to adjacent region: {0} {1},{2}", | ||
855 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
856 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
857 | |||
858 | return false; | ||
859 | } | ||
860 | } | ||
861 | else | ||
862 | { | ||
863 | //m_log.Info("[INTERREGION]: Skipped Sending Child Update to a region because it failed too many times:" + regionHandle.ToString()); | ||
864 | return false; | ||
865 | } | ||
866 | } | ||
867 | |||
868 | /// <summary> | ||
869 | /// Inform a region that a child agent will be on the way from a client. | ||
870 | /// </summary> | ||
871 | /// <param name="regionHandle"></param> | ||
872 | /// <param name="agentData"></param> | ||
873 | /// <returns></returns> | ||
874 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
875 | { | ||
876 | RegionInfo regInfo = null; | ||
877 | try | ||
878 | { | ||
879 | if (m_localBackend.InformRegionOfChildAgent(regionHandle, agentData)) | ||
880 | { | ||
881 | return true; | ||
882 | } | ||
883 | |||
884 | regInfo = RequestNeighbourInfo(regionHandle); | ||
885 | if (regInfo != null) | ||
886 | { | ||
887 | //don't want to be creating a new link to the remote instance every time like we are here | ||
888 | bool retValue = false; | ||
889 | |||
890 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
891 | typeof(OGS1InterRegionRemoting), | ||
892 | "tcp://" + regInfo.RemotingAddress + | ||
893 | ":" + regInfo.RemotingPort + | ||
894 | "/InterRegions"); | ||
895 | |||
896 | if (remObject != null) | ||
897 | { | ||
898 | retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); | ||
899 | } | ||
900 | else | ||
901 | { | ||
902 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); | ||
903 | } | ||
904 | remObject = null; | ||
905 | m_log.Info("[OGS1 GRID SERVICES]: " + | ||
906 | m_localBackend._gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + | ||
907 | agentData.firstname + " " + agentData.lastname + " and got " + | ||
908 | retValue.ToString()); | ||
909 | |||
910 | return retValue; | ||
911 | } | ||
912 | NoteDeadRegion(regionHandle); | ||
913 | return false; | ||
914 | } | ||
915 | catch (RemotingException e) | ||
916 | { | ||
917 | NoteDeadRegion(regionHandle); | ||
918 | |||
919 | m_log.WarnFormat( | ||
920 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
921 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
922 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
923 | |||
924 | return false; | ||
925 | } | ||
926 | catch (SocketException e) | ||
927 | { | ||
928 | NoteDeadRegion(regionHandle); | ||
929 | |||
930 | m_log.WarnFormat( | ||
931 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
932 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
933 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
934 | |||
935 | return false; | ||
936 | } | ||
937 | catch (InvalidCredentialException e) | ||
938 | { | ||
939 | NoteDeadRegion(regionHandle); | ||
940 | |||
941 | m_log.WarnFormat( | ||
942 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
943 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
944 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
945 | |||
946 | return false; | ||
947 | } | ||
948 | catch (AuthenticationException e) | ||
949 | { | ||
950 | NoteDeadRegion(regionHandle); | ||
951 | |||
952 | m_log.WarnFormat( | ||
953 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
954 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
955 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
956 | |||
957 | return false; | ||
958 | } | ||
959 | catch (Exception e) | ||
960 | { | ||
961 | NoteDeadRegion(regionHandle); | ||
962 | |||
963 | if (regInfo != null) | ||
964 | { | ||
965 | m_log.WarnFormat( | ||
966 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
967 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
968 | } | ||
969 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
970 | |||
971 | return false; | ||
972 | } | ||
973 | } | ||
974 | |||
975 | // UGLY! | ||
976 | public bool RegionUp(SerializableRegionInfo region, ulong regionhandle) | ||
977 | { | ||
978 | SerializableRegionInfo regInfo = null; | ||
979 | try | ||
980 | { | ||
981 | // You may ask why this is in here... | ||
982 | // The region asking the grid services about itself.. | ||
983 | // And, surprisingly, the reason is.. it doesn't know | ||
984 | // it's own remoting port! How special. | ||
985 | RegionUpData regiondata = new RegionUpData(region.RegionLocX, region.RegionLocY, region.ExternalHostName, region.InternalEndPoint.Port); | ||
986 | |||
987 | region = new SerializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); | ||
988 | region.RemotingAddress = region.ExternalHostName; | ||
989 | region.RemotingPort = NetworkServersInfo.RemotingListenerPort; | ||
990 | region.HttpPort = serversInfo.HttpListenerPort; | ||
991 | |||
992 | if (m_localBackend.RegionUp(region, regionhandle)) | ||
993 | { | ||
994 | return true; | ||
995 | } | ||
996 | |||
997 | regInfo = new SerializableRegionInfo(RequestNeighbourInfo(regionhandle)); | ||
998 | if (regInfo != null) | ||
999 | { | ||
1000 | // If we're not trying to remote to ourselves. | ||
1001 | if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) | ||
1002 | { | ||
1003 | //don't want to be creating a new link to the remote instance every time like we are here | ||
1004 | bool retValue = false; | ||
1005 | |||
1006 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | ||
1007 | typeof(OGS1InterRegionRemoting), | ||
1008 | "tcp://" + | ||
1009 | regInfo.RemotingAddress + | ||
1010 | ":" + regInfo.RemotingPort + | ||
1011 | "/InterRegions"); | ||
1012 | |||
1013 | if (remObject != null) | ||
1014 | { | ||
1015 | retValue = remObject.RegionUp(regiondata, regionhandle); | ||
1016 | } | ||
1017 | else | ||
1018 | { | ||
1019 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); | ||
1020 | } | ||
1021 | remObject = null; | ||
1022 | |||
1023 | m_log.Info( | ||
1024 | "[INTER]: " + m_localBackend._gdebugRegionName + ": OGS1 tried to inform region I'm up"); | ||
1025 | |||
1026 | return retValue; | ||
1027 | } | ||
1028 | else | ||
1029 | { | ||
1030 | // We're trying to inform ourselves via remoting. | ||
1031 | // This is here because we're looping over the listeners before we get here. | ||
1032 | // Odd but it should work. | ||
1033 | return true; | ||
1034 | } | ||
1035 | } | ||
1036 | |||
1037 | return false; | ||
1038 | } | ||
1039 | catch (RemotingException e) | ||
1040 | { | ||
1041 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region using tcp://" + | ||
1042 | regInfo.RemotingAddress + | ||
1043 | ":" + regInfo.RemotingPort + | ||
1044 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
1045 | " - Is this neighbor up?"); | ||
1046 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1047 | return false; | ||
1048 | } | ||
1049 | catch (SocketException e) | ||
1050 | { | ||
1051 | m_log.Warn("[OGS1 GRID SERVICES]: Socket Error: Unable to connect to adjacent region using tcp://" + | ||
1052 | regInfo.RemotingAddress + | ||
1053 | ":" + regInfo.RemotingPort + | ||
1054 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
1055 | " - Is this neighbor up?"); | ||
1056 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1057 | return false; | ||
1058 | } | ||
1059 | catch (InvalidCredentialException e) | ||
1060 | { | ||
1061 | m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | ||
1062 | regInfo.RemotingAddress + | ||
1063 | ":" + regInfo.RemotingPort + | ||
1064 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1065 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1066 | return false; | ||
1067 | } | ||
1068 | catch (AuthenticationException e) | ||
1069 | { | ||
1070 | m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region using tcp://" + | ||
1071 | regInfo.RemotingAddress + | ||
1072 | ":" + regInfo.RemotingPort + | ||
1073 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1074 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1075 | return false; | ||
1076 | } | ||
1077 | catch (Exception e) | ||
1078 | { | ||
1079 | // This line errors with a Null Reference Exception.. Why? @.@ | ||
1080 | //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + | ||
1081 | // ":" + regInfo.RemotingPort + | ||
1082 | //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); | ||
1083 | m_log.Debug(e.ToString()); | ||
1084 | return false; | ||
1085 | } | ||
1086 | } | ||
1087 | |||
1088 | /// <summary> | ||
1089 | /// | ||
1090 | /// </summary> | ||
1091 | /// <param name="regionHandle"></param> | ||
1092 | /// <param name="agentData"></param> | ||
1093 | /// <returns></returns> | ||
1094 | public bool InformRegionOfPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
1095 | { | ||
1096 | int failures = 0; | ||
1097 | lock (m_deadRegionCache) | ||
1098 | { | ||
1099 | if (m_deadRegionCache.ContainsKey(regionHandle)) | ||
1100 | { | ||
1101 | failures = m_deadRegionCache[regionHandle]; | ||
1102 | } | ||
1103 | } | ||
1104 | if (failures <= 1) | ||
1105 | { | ||
1106 | RegionInfo regInfo = null; | ||
1107 | try | ||
1108 | { | ||
1109 | if (m_localBackend.InformRegionOfPrimCrossing(regionHandle, primID, objData, XMLMethod)) | ||
1110 | { | ||
1111 | return true; | ||
1112 | } | ||
1113 | |||
1114 | regInfo = RequestNeighbourInfo(regionHandle); | ||
1115 | if (regInfo != null) | ||
1116 | { | ||
1117 | //don't want to be creating a new link to the remote instance every time like we are here | ||
1118 | bool retValue = false; | ||
1119 | |||
1120 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
1121 | typeof(OGS1InterRegionRemoting), | ||
1122 | "tcp://" + regInfo.RemotingAddress + | ||
1123 | ":" + regInfo.RemotingPort + | ||
1124 | "/InterRegions"); | ||
1125 | |||
1126 | if (remObject != null) | ||
1127 | { | ||
1128 | m_log.DebugFormat("[INTERREGION]: Sending prim crossing message for prim {0}", primID.ToString()); | ||
1129 | retValue = remObject.InformRegionOfPrimCrossing(regionHandle, primID.Guid, objData, XMLMethod); | ||
1130 | m_log.DebugFormat("[INTERREGION]: Return from prim crossing message for prim {0}: {1}", primID.ToString(), retValue.ToString()); | ||
1131 | } | ||
1132 | else | ||
1133 | { | ||
1134 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found"); | ||
1135 | } | ||
1136 | remObject = null; | ||
1137 | |||
1138 | return retValue; | ||
1139 | } | ||
1140 | NoteDeadRegion(regionHandle); | ||
1141 | return false; | ||
1142 | } | ||
1143 | catch (RemotingException e) | ||
1144 | { | ||
1145 | NoteDeadRegion(regionHandle); | ||
1146 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
1147 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1148 | return false; | ||
1149 | } | ||
1150 | catch (SocketException e) | ||
1151 | { | ||
1152 | NoteDeadRegion(regionHandle); | ||
1153 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
1154 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1155 | return false; | ||
1156 | } | ||
1157 | catch (InvalidCredentialException e) | ||
1158 | { | ||
1159 | NoteDeadRegion(regionHandle); | ||
1160 | m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | ||
1161 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1162 | return false; | ||
1163 | } | ||
1164 | catch (AuthenticationException e) | ||
1165 | { | ||
1166 | NoteDeadRegion(regionHandle); | ||
1167 | m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | ||
1168 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1169 | return false; | ||
1170 | } | ||
1171 | catch (Exception e) | ||
1172 | { | ||
1173 | NoteDeadRegion(regionHandle); | ||
1174 | m_log.Warn("[OGS1 GRID SERVICES]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | ||
1175 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e); | ||
1176 | return false; | ||
1177 | } | ||
1178 | } | ||
1179 | else | ||
1180 | { | ||
1181 | return false; | ||
1182 | } | ||
1183 | } | ||
1184 | |||
1185 | /// <summary> | ||
1186 | /// | ||
1187 | /// </summary> | ||
1188 | /// <param name="regionHandle"></param> | ||
1189 | /// <param name="agentID"></param> | ||
1190 | /// <param name="position"></param> | ||
1191 | /// <returns></returns> | ||
1192 | public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
1193 | { | ||
1194 | RegionInfo[] regions = m_regionsOnInstance.ToArray(); | ||
1195 | bool banned = false; | ||
1196 | |||
1197 | for (int i = 0; i < regions.Length; i++) | ||
1198 | { | ||
1199 | if (regions[i] != null) | ||
1200 | { | ||
1201 | if (regions[i].RegionHandle == regionHandle) | ||
1202 | { | ||
1203 | if (regions[i].EstateSettings.IsBanned(agentID)) | ||
1204 | { | ||
1205 | banned = true; | ||
1206 | break; | ||
1207 | } | ||
1208 | } | ||
1209 | } | ||
1210 | } | ||
1211 | |||
1212 | if (banned) | ||
1213 | return false; | ||
1214 | |||
1215 | RegionInfo regInfo = null; | ||
1216 | try | ||
1217 | { | ||
1218 | if (m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying)) | ||
1219 | { | ||
1220 | return true; | ||
1221 | } | ||
1222 | |||
1223 | regInfo = RequestNeighbourInfo(regionHandle); | ||
1224 | if (regInfo != null) | ||
1225 | { | ||
1226 | bool retValue = false; | ||
1227 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | ||
1228 | typeof (OGS1InterRegionRemoting), | ||
1229 | "tcp://" + regInfo.RemotingAddress + | ||
1230 | ":" + regInfo.RemotingPort + | ||
1231 | "/InterRegions"); | ||
1232 | |||
1233 | if (remObject != null) | ||
1234 | { | ||
1235 | retValue = | ||
1236 | remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position), | ||
1237 | isFlying); | ||
1238 | } | ||
1239 | else | ||
1240 | { | ||
1241 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found"); | ||
1242 | } | ||
1243 | remObject = null; | ||
1244 | |||
1245 | return retValue; | ||
1246 | } | ||
1247 | //TODO need to see if we know about where this region is and use .net remoting | ||
1248 | // to inform it. | ||
1249 | NoteDeadRegion(regionHandle); | ||
1250 | return false; | ||
1251 | } | ||
1252 | catch (RemotingException e) | ||
1253 | { | ||
1254 | NoteDeadRegion(regionHandle); | ||
1255 | |||
1256 | m_log.WarnFormat( | ||
1257 | "[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: {0} {1},{2}", | ||
1258 | regInfo.RegionName, regInfo.RegionLocX, regInfo.RegionLocY); | ||
1259 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1260 | |||
1261 | return false; | ||
1262 | } | ||
1263 | catch | ||
1264 | { | ||
1265 | NoteDeadRegion(regionHandle); | ||
1266 | return false; | ||
1267 | } | ||
1268 | } | ||
1269 | |||
1270 | public bool ExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | ||
1271 | { | ||
1272 | RegionInfo regInfo = null; | ||
1273 | try | ||
1274 | { | ||
1275 | if (m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical)) | ||
1276 | { | ||
1277 | return true; | ||
1278 | } | ||
1279 | |||
1280 | regInfo = RequestNeighbourInfo(regionHandle); | ||
1281 | if (regInfo != null) | ||
1282 | { | ||
1283 | bool retValue = false; | ||
1284 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | ||
1285 | typeof (OGS1InterRegionRemoting), | ||
1286 | "tcp://" + regInfo.RemotingAddress + | ||
1287 | ":" + regInfo.RemotingPort + | ||
1288 | "/InterRegions"); | ||
1289 | |||
1290 | if (remObject != null) | ||
1291 | { | ||
1292 | retValue = | ||
1293 | remObject.ExpectAvatarCrossing(regionHandle, agentID.Guid, new sLLVector3(position), | ||
1294 | isPhysical); | ||
1295 | } | ||
1296 | else | ||
1297 | { | ||
1298 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found"); | ||
1299 | } | ||
1300 | remObject = null; | ||
1301 | |||
1302 | return retValue; | ||
1303 | } | ||
1304 | //TODO need to see if we know about where this region is and use .net remoting | ||
1305 | // to inform it. | ||
1306 | NoteDeadRegion(regionHandle); | ||
1307 | return false; | ||
1308 | } | ||
1309 | catch (RemotingException e) | ||
1310 | { | ||
1311 | NoteDeadRegion(regionHandle); | ||
1312 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
1313 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1314 | return false; | ||
1315 | } | ||
1316 | catch (SocketException e) | ||
1317 | { | ||
1318 | NoteDeadRegion(regionHandle); | ||
1319 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region: " + regionHandle); | ||
1320 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1321 | return false; | ||
1322 | } | ||
1323 | catch (InvalidCredentialException e) | ||
1324 | { | ||
1325 | NoteDeadRegion(regionHandle); | ||
1326 | m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credential Exception: Invalid Credentials : " + regionHandle); | ||
1327 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1328 | return false; | ||
1329 | } | ||
1330 | catch (AuthenticationException e) | ||
1331 | { | ||
1332 | NoteDeadRegion(regionHandle); | ||
1333 | m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region: " + regionHandle); | ||
1334 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1335 | return false; | ||
1336 | } | ||
1337 | catch (Exception e) | ||
1338 | { | ||
1339 | NoteDeadRegion(regionHandle); | ||
1340 | m_log.Warn("[OGS1 GRID SERVICES]: Unknown exception: Unable to connect to adjacent region: " + regionHandle); | ||
1341 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e); | ||
1342 | return false; | ||
1343 | } | ||
1344 | } | ||
1345 | |||
1346 | public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
1347 | { | ||
1348 | RegionInfo regInfo = null; | ||
1349 | try | ||
1350 | { | ||
1351 | if (m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID)) | ||
1352 | { | ||
1353 | return true; | ||
1354 | } | ||
1355 | |||
1356 | regInfo = RequestNeighbourInfo(regionHandle); | ||
1357 | if (regInfo != null) | ||
1358 | { | ||
1359 | // bool retValue = false; | ||
1360 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
1361 | typeof(OGS1InterRegionRemoting), | ||
1362 | "tcp://" + regInfo.RemotingAddress + | ||
1363 | ":" + regInfo.RemotingPort + | ||
1364 | "/InterRegions"); | ||
1365 | |||
1366 | if (remObject != null) | ||
1367 | { | ||
1368 | // retValue = | ||
1369 | remObject.TellRegionToCloseChildConnection(regionHandle, agentID.Guid); | ||
1370 | } | ||
1371 | else | ||
1372 | { | ||
1373 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting object not found"); | ||
1374 | } | ||
1375 | remObject = null; | ||
1376 | |||
1377 | return true; | ||
1378 | } | ||
1379 | //TODO need to see if we know about where this region is and use .net remoting | ||
1380 | // to inform it. | ||
1381 | NoteDeadRegion(regionHandle); | ||
1382 | return false; | ||
1383 | } | ||
1384 | catch (RemotingException) | ||
1385 | { | ||
1386 | NoteDeadRegion(regionHandle); | ||
1387 | m_log.Warn("[OGS1 GRID SERVICES]: Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName + | ||
1388 | " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1389 | //m_log.Debug(e.ToString()); | ||
1390 | return false; | ||
1391 | } | ||
1392 | catch (SocketException e) | ||
1393 | { | ||
1394 | NoteDeadRegion(regionHandle); | ||
1395 | m_log.Warn("[OGS1 GRID SERVICES]: Socket Error: Unable to connect to adjacent region using tcp://" + | ||
1396 | regInfo.RemotingAddress + | ||
1397 | ":" + regInfo.RemotingPort + | ||
1398 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + | ||
1399 | " - Is this neighbor up?"); | ||
1400 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1401 | return false; | ||
1402 | } | ||
1403 | catch (InvalidCredentialException e) | ||
1404 | { | ||
1405 | NoteDeadRegion(regionHandle); | ||
1406 | m_log.Warn("[OGS1 GRID SERVICES]: Invalid Credentials: Unable to connect to adjacent region using tcp://" + | ||
1407 | regInfo.RemotingAddress + | ||
1408 | ":" + regInfo.RemotingPort + | ||
1409 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1410 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1411 | return false; | ||
1412 | } | ||
1413 | catch (AuthenticationException e) | ||
1414 | { | ||
1415 | NoteDeadRegion(regionHandle); | ||
1416 | m_log.Warn("[OGS1 GRID SERVICES]: Authentication exception: Unable to connect to adjacent region using tcp://" + | ||
1417 | regInfo.RemotingAddress + | ||
1418 | ":" + regInfo.RemotingPort + | ||
1419 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1420 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1421 | return false; | ||
1422 | } | ||
1423 | catch (WebException e) | ||
1424 | { | ||
1425 | NoteDeadRegion(regionHandle); | ||
1426 | m_log.Warn("[OGS1 GRID SERVICES]: WebException exception: Unable to connect to adjacent region using tcp://" + | ||
1427 | regInfo.RemotingAddress + | ||
1428 | ":" + regInfo.RemotingPort + | ||
1429 | "/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
1430 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0} {1}", e.Source, e.Message); | ||
1431 | return false; | ||
1432 | } | ||
1433 | catch (Exception e) | ||
1434 | { | ||
1435 | NoteDeadRegion(regionHandle); | ||
1436 | // This line errors with a Null Reference Exception.. Why? @.@ | ||
1437 | //m_log.Warn("Unknown exception: Unable to connect to adjacent region using tcp://" + regInfo.RemotingAddress + | ||
1438 | // ":" + regInfo.RemotingPort + | ||
1439 | //"/InterRegions - @ " + regInfo.RegionLocX + "," + regInfo.RegionLocY + " - This is likely caused by an incompatibility in the protocol between this sim and that one"); | ||
1440 | m_log.DebugFormat("[OGS1 GRID SERVICES]: {0}", e); | ||
1441 | return false; | ||
1442 | } | ||
1443 | } | ||
1444 | |||
1445 | public bool AcknowledgeAgentCrossed(ulong regionHandle, UUID agentId) | ||
1446 | { | ||
1447 | return m_localBackend.AcknowledgeAgentCrossed(regionHandle, agentId); | ||
1448 | } | ||
1449 | |||
1450 | public bool AcknowledgePrimCrossed(ulong regionHandle, UUID primId) | ||
1451 | { | ||
1452 | return m_localBackend.AcknowledgePrimCrossed(regionHandle, primId); | ||
1453 | } | ||
1454 | |||
1455 | #endregion | ||
1456 | |||
1457 | #region Methods triggered by calls from external instances | ||
1458 | |||
1459 | /// <summary> | ||
1460 | /// | ||
1461 | /// </summary> | ||
1462 | /// <param name="regionHandle"></param> | ||
1463 | /// <param name="agentData"></param> | ||
1464 | /// <returns></returns> | ||
1465 | public bool IncomingChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
1466 | { | ||
1467 | //m_log.Info("[INTER]: " + gdebugRegionName + ": Incoming OGS1 Agent " + agentData.firstname + " " + agentData.lastname); | ||
1468 | |||
1469 | return m_localBackend.IncomingChildAgent(regionHandle, agentData); | ||
1470 | } | ||
1471 | |||
1472 | public bool TriggerRegionUp(RegionUpData regionData, ulong regionhandle) | ||
1473 | { | ||
1474 | m_log.Info( | ||
1475 | "[OGS1 GRID SERVICES]: " + | ||
1476 | m_localBackend._gdebugRegionName + "Incoming OGS1 RegionUpReport: " + "(" + regionData.X + | ||
1477 | "," + regionData.Y + "). Giving this region a fresh set of 'dead' tries"); | ||
1478 | |||
1479 | RegionInfo nRegionInfo = new RegionInfo(); | ||
1480 | nRegionInfo.SetEndPoint("127.0.0.1", regionData.PORT); | ||
1481 | nRegionInfo.ExternalHostName = regionData.IPADDR; | ||
1482 | nRegionInfo.RegionLocX = regionData.X; | ||
1483 | nRegionInfo.RegionLocY = regionData.Y; | ||
1484 | |||
1485 | lock (m_deadRegionCache) | ||
1486 | { | ||
1487 | if (m_deadRegionCache.ContainsKey(nRegionInfo.RegionHandle)) | ||
1488 | { | ||
1489 | m_deadRegionCache.Remove(nRegionInfo.RegionHandle); | ||
1490 | } | ||
1491 | } | ||
1492 | |||
1493 | return m_localBackend.TriggerRegionUp(nRegionInfo, regionhandle); | ||
1494 | } | ||
1495 | |||
1496 | public bool TriggerChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
1497 | { | ||
1498 | //m_log.Info("[INTER]: Incoming OGS1 Child Agent Data Update"); | ||
1499 | |||
1500 | return m_localBackend.TriggerChildAgentUpdate(regionHandle, cAgentData); | ||
1501 | } | ||
1502 | |||
1503 | /// <summary> | ||
1504 | /// | ||
1505 | /// </summary> | ||
1506 | /// <param name="regionHandle"></param> | ||
1507 | /// <param name="agentData"></param> | ||
1508 | /// <returns></returns> | ||
1509 | public bool IncomingPrim(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
1510 | { | ||
1511 | m_log.DebugFormat("[INTERREGION]: Got prim crosssing request for {0}", primID); | ||
1512 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData, XMLMethod); | ||
1513 | |||
1514 | return true; | ||
1515 | } | ||
1516 | |||
1517 | /// <summary> | ||
1518 | /// | ||
1519 | /// </summary> | ||
1520 | /// <param name="regionHandle"></param> | ||
1521 | /// <param name="agentID"></param> | ||
1522 | /// <param name="position"></param> | ||
1523 | /// <returns></returns> | ||
1524 | public bool TriggerExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
1525 | { | ||
1526 | return m_localBackend.TriggerExpectAvatarCrossing(regionHandle, agentID, position, isFlying); | ||
1527 | } | ||
1528 | |||
1529 | public bool TriggerExpectPrimCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isPhysical) | ||
1530 | { | ||
1531 | return m_localBackend.TriggerExpectPrimCrossing(regionHandle, agentID, position, isPhysical); | ||
1532 | } | ||
1533 | |||
1534 | public bool TriggerTellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
1535 | { | ||
1536 | return m_localBackend.TriggerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
1537 | } | ||
1538 | |||
1539 | #endregion | ||
1540 | |||
1541 | #endregion | ||
1542 | |||
1543 | int timeOut = 10; //10 seconds | ||
1544 | |||
1545 | /// <summary> | ||
1546 | /// Check that a region is available for TCP comms. This is necessary for .NET remoting between regions. | ||
1547 | /// </summary> | ||
1548 | /// <param name="address"></param> | ||
1549 | /// <param name="port"></param> | ||
1550 | /// <param name="retry"></param> | ||
1551 | /// <returns></returns> | ||
1552 | public bool CheckRegion(string address, uint port, bool retry) | ||
1553 | { | ||
1554 | bool available = false; | ||
1555 | bool timed_out = true; | ||
1556 | |||
1557 | IPAddress ia = Util.GetHostFromDNS(address); | ||
1558 | IPEndPoint m_EndPoint; | ||
1559 | try | ||
1560 | { | ||
1561 | m_EndPoint = new IPEndPoint(ia, (int)port); | ||
1562 | } | ||
1563 | catch (Exception) | ||
1564 | { | ||
1565 | m_log.Debug("[OGS1 GRID SERVICES]: Invalid remoting address: " + address); | ||
1566 | return false; | ||
1567 | } | ||
1568 | |||
1569 | AsyncCallback callback = delegate(IAsyncResult iar) | ||
1570 | { | ||
1571 | timed_out = false; | ||
1572 | |||
1573 | Socket s = (Socket)iar.AsyncState; | ||
1574 | try | ||
1575 | { | ||
1576 | s.EndConnect(iar); | ||
1577 | available = true; | ||
1578 | } | ||
1579 | catch (Exception e) | ||
1580 | { | ||
1581 | m_log.DebugFormat( | ||
1582 | "[OGS1 GRID SERVICES]: Callback EndConnect exception: {0}:{1}", e.Message, e.StackTrace); | ||
1583 | } | ||
1584 | |||
1585 | s.Close(); | ||
1586 | }; | ||
1587 | |||
1588 | IAsyncResult ar; | ||
1589 | |||
1590 | try | ||
1591 | { | ||
1592 | Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); | ||
1593 | ar = socket.BeginConnect(m_EndPoint, callback, socket); | ||
1594 | ar.AsyncWaitHandle.WaitOne(timeOut * 1000, false); | ||
1595 | } | ||
1596 | catch (Exception e) | ||
1597 | { | ||
1598 | m_log.DebugFormat( | ||
1599 | "[OGS1 GRID SERVICES]: CheckRegion Socket Setup exception: {0}:{1}", e.Message, e.StackTrace); | ||
1600 | |||
1601 | return false; | ||
1602 | } | ||
1603 | |||
1604 | if (timed_out) | ||
1605 | { | ||
1606 | ar.AsyncWaitHandle.Close(); | ||
1607 | |||
1608 | m_log.DebugFormat( | ||
1609 | "[OGS1 GRID SERVICES]: socket [{0}] timed out ({1}) waiting to obtain a connection.", | ||
1610 | m_EndPoint, timeOut * 1000); | ||
1611 | |||
1612 | if (retry) | ||
1613 | { | ||
1614 | return CheckRegion(address, port, false); | ||
1615 | } | ||
1616 | } | ||
1617 | |||
1618 | return available; | ||
1619 | } | ||
1620 | |||
1621 | public bool CheckRegion(string address, uint port) | ||
1622 | { | ||
1623 | return CheckRegion(address, port, true); | ||
1624 | } | ||
1625 | |||
1626 | public void NoteDeadRegion(ulong regionhandle) | 715 | public void NoteDeadRegion(ulong regionhandle) |
1627 | { | 716 | { |
1628 | lock (m_deadRegionCache) | 717 | lock (m_deadRegionCache) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs deleted file mode 100644 index dd4d0aa..0000000 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ /dev/null | |||
@@ -1,263 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Runtime.Remoting; | ||
31 | using log4net; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | namespace OpenSim.Region.Communications.OGS1 | ||
36 | { | ||
37 | public delegate bool InformRegionChild(ulong regionHandle, AgentCircuitData agentData); | ||
38 | |||
39 | public delegate bool ExpectArrival(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying); | ||
40 | |||
41 | public delegate bool InformRegionPrimGroup(ulong regionHandle, UUID primID, Vector3 Positon, bool isPhysical); | ||
42 | |||
43 | public delegate bool PrimGroupArrival(ulong regionHandle, UUID primID, string objData, int XMLMethod); | ||
44 | |||
45 | public delegate bool RegionUp(RegionUpData region, ulong regionhandle); | ||
46 | |||
47 | public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate childUpdate); | ||
48 | |||
49 | public delegate bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID); | ||
50 | |||
51 | public sealed class InterRegionSingleton | ||
52 | { | ||
53 | private static readonly InterRegionSingleton instance = new InterRegionSingleton(); | ||
54 | |||
55 | public event InformRegionChild OnChildAgent; | ||
56 | public event ExpectArrival OnArrival; | ||
57 | public event InformRegionPrimGroup OnPrimGroupNear; | ||
58 | public event PrimGroupArrival OnPrimGroupArrival; | ||
59 | public event RegionUp OnRegionUp; | ||
60 | public event ChildAgentUpdate OnChildAgentUpdate; | ||
61 | public event TellRegionToCloseChildConnection OnTellRegionToCloseChildConnection; | ||
62 | |||
63 | private InformRegionChild handlerChildAgent = null; // OnChildAgent; | ||
64 | private ExpectArrival handlerArrival = null; // OnArrival; | ||
65 | private InformRegionPrimGroup handlerPrimGroupNear = null; // OnPrimGroupNear; | ||
66 | private PrimGroupArrival handlerPrimGroupArrival = null; // OnPrimGroupArrival; | ||
67 | private RegionUp handlerRegionUp = null; // OnRegionUp; | ||
68 | private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; | ||
69 | private TellRegionToCloseChildConnection handlerTellRegionToCloseChildConnection = null; // OnTellRegionToCloseChildConnection; | ||
70 | |||
71 | |||
72 | static InterRegionSingleton() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | private InterRegionSingleton() | ||
77 | { | ||
78 | } | ||
79 | |||
80 | public static InterRegionSingleton Instance | ||
81 | { | ||
82 | get { return instance; } | ||
83 | } | ||
84 | |||
85 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | ||
86 | { | ||
87 | handlerChildAgent = OnChildAgent; | ||
88 | if (handlerChildAgent != null) | ||
89 | { | ||
90 | return handlerChildAgent(regionHandle, agentData); | ||
91 | } | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | public bool RegionUp(RegionUpData sregion, ulong regionhandle) | ||
96 | { | ||
97 | handlerRegionUp = OnRegionUp; | ||
98 | if (handlerRegionUp != null) | ||
99 | { | ||
100 | return handlerRegionUp(sregion, regionhandle); | ||
101 | } | ||
102 | return false; | ||
103 | } | ||
104 | |||
105 | public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentUpdate) | ||
106 | { | ||
107 | handlerChildAgentUpdate = OnChildAgentUpdate; | ||
108 | if (handlerChildAgentUpdate != null) | ||
109 | { | ||
110 | return handlerChildAgentUpdate(regionHandle, cAgentUpdate); | ||
111 | } | ||
112 | return false; | ||
113 | } | ||
114 | |||
115 | public bool ExpectAvatarCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
116 | { | ||
117 | handlerArrival = OnArrival; | ||
118 | if (handlerArrival != null) | ||
119 | { | ||
120 | return handlerArrival(regionHandle, agentID, position, isFlying); | ||
121 | } | ||
122 | return false; | ||
123 | } | ||
124 | |||
125 | public bool InformRegionPrim(ulong regionHandle, UUID primID, Vector3 position, bool isPhysical) | ||
126 | { | ||
127 | handlerPrimGroupNear = OnPrimGroupNear; | ||
128 | if (handlerPrimGroupNear != null) | ||
129 | { | ||
130 | return handlerPrimGroupNear(regionHandle, primID, position, isPhysical); | ||
131 | } | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | public bool ExpectPrimCrossing(ulong regionHandle, UUID primID, string objData, int XMLMethod) | ||
136 | { | ||
137 | handlerPrimGroupArrival = OnPrimGroupArrival; | ||
138 | if (handlerPrimGroupArrival != null) | ||
139 | { | ||
140 | return handlerPrimGroupArrival(regionHandle, primID, objData, XMLMethod); | ||
141 | } | ||
142 | return false; | ||
143 | } | ||
144 | |||
145 | public bool TellRegionToCloseChildConnection(ulong regionHandle, UUID agentID) | ||
146 | { | ||
147 | handlerTellRegionToCloseChildConnection = OnTellRegionToCloseChildConnection; | ||
148 | if (handlerTellRegionToCloseChildConnection != null) | ||
149 | { | ||
150 | return handlerTellRegionToCloseChildConnection(regionHandle, agentID); | ||
151 | } | ||
152 | return false; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | public class OGS1InterRegionRemoting : MarshalByRefObject | ||
157 | { | ||
158 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
159 | |||
160 | public OGS1InterRegionRemoting() | ||
161 | { | ||
162 | } | ||
163 | |||
164 | public bool InformRegionOfChildAgent(ulong regionHandle, sAgentCircuitData agentData) | ||
165 | { | ||
166 | try | ||
167 | { | ||
168 | return | ||
169 | InterRegionSingleton.Instance.InformRegionOfChildAgent(regionHandle, new AgentCircuitData(agentData)); | ||
170 | } | ||
171 | catch (RemotingException e) | ||
172 | { | ||
173 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
174 | return false; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | public bool RegionUp(RegionUpData region, ulong regionhandle) | ||
179 | { | ||
180 | try | ||
181 | { | ||
182 | return InterRegionSingleton.Instance.RegionUp(region, regionhandle); | ||
183 | } | ||
184 | catch (RemotingException e) | ||
185 | { | ||
186 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
187 | return false; | ||
188 | } | ||
189 | } | ||
190 | |||
191 | public bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData) | ||
192 | { | ||
193 | try | ||
194 | { | ||
195 | return InterRegionSingleton.Instance.ChildAgentUpdate(regionHandle, cAgentData); | ||
196 | } | ||
197 | catch (RemotingException e) | ||
198 | { | ||
199 | Console.WriteLine("Remoting Error: Unable to send Child agent update to remote region.\n" + e.ToString()); | ||
200 | return false; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | |||
205 | public bool ExpectAvatarCrossing(ulong regionHandle, Guid agentID, sLLVector3 position, bool isFlying) | ||
206 | { | ||
207 | try | ||
208 | { | ||
209 | return | ||
210 | InterRegionSingleton.Instance.ExpectAvatarCrossing(regionHandle, new UUID(agentID), | ||
211 | new Vector3(position.x, position.y, position.z), | ||
212 | isFlying); | ||
213 | } | ||
214 | catch (RemotingException e) | ||
215 | { | ||
216 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
217 | return false; | ||
218 | } | ||
219 | } | ||
220 | |||
221 | public bool InformRegionPrim(ulong regionHandle, Guid SceneObjectGroupID, sLLVector3 position, bool isPhysical) | ||
222 | { | ||
223 | try | ||
224 | { | ||
225 | return | ||
226 | InterRegionSingleton.Instance.InformRegionPrim(regionHandle, new UUID(SceneObjectGroupID), | ||
227 | new Vector3(position.x, position.y, position.z), | ||
228 | isPhysical); | ||
229 | } | ||
230 | catch (RemotingException e) | ||
231 | { | ||
232 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
233 | return false; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | public bool InformRegionOfPrimCrossing(ulong regionHandle, Guid primID, string objData, int XMLMethod) | ||
238 | { | ||
239 | try | ||
240 | { | ||
241 | return InterRegionSingleton.Instance.ExpectPrimCrossing(regionHandle, new UUID(primID), objData, XMLMethod); | ||
242 | } | ||
243 | catch (RemotingException e) | ||
244 | { | ||
245 | Console.WriteLine("Remoting Error: Unable to connect to remote region.\n" + e.ToString()); | ||
246 | return false; | ||
247 | } | ||
248 | } | ||
249 | |||
250 | public bool TellRegionToCloseChildConnection(ulong regionHandle, Guid agentID) | ||
251 | { | ||
252 | try | ||
253 | { | ||
254 | return InterRegionSingleton.Instance.TellRegionToCloseChildConnection(regionHandle, new UUID(agentID)); | ||
255 | } | ||
256 | catch (RemotingException) | ||
257 | { | ||
258 | m_log.Info("[INTERREGION]: Remoting Error: Unable to connect to remote region: " + regionHandle.ToString()); | ||
259 | return false; | ||
260 | } | ||
261 | } | ||
262 | } | ||
263 | } | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1f6d647..aa8b51a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2112,21 +2112,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2112 | appearance = new AvatarAppearance(); | 2112 | appearance = new AvatarAppearance(); |
2113 | } | 2113 | } |
2114 | 2114 | ||
2115 | //try | ||
2116 | //{ | ||
2117 | // if (m_AvatarFactory != null) | ||
2118 | // { | ||
2119 | // if (m_AvatarFactory.TryGetAvatarAppearance(client.AgentId, out appearance)) | ||
2120 | // return; | ||
2121 | // } | ||
2122 | //} | ||
2123 | //catch (Exception e) | ||
2124 | //{ | ||
2125 | // m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}", | ||
2126 | // client.Name, e); | ||
2127 | //} | ||
2128 | |||
2129 | //m_log.Warn("[APPEARANCE]: Appearance not found, returning default"); | ||
2130 | } | 2115 | } |
2131 | 2116 | ||
2132 | /// <summary> | 2117 | /// <summary> |
@@ -2692,19 +2677,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2692 | } | 2677 | } |
2693 | } | 2678 | } |
2694 | 2679 | ||
2695 | /// <summary> | ||
2696 | /// Agent is crossing the border into a neighbouring region. Tell the neighbour about it! | ||
2697 | /// </summary> | ||
2698 | /// <param name="regionHandle"></param> | ||
2699 | /// <param name="agentID"></param> | ||
2700 | /// <param name="position"></param> | ||
2701 | /// <param name="isFlying"></param> | ||
2702 | /// <returns></returns> | ||
2703 | public bool InformNeighbourOfCrossing(ulong regionHandle, UUID agentID, Vector3 position, bool isFlying) | ||
2704 | { | ||
2705 | return m_sceneGridService.CrossToNeighbouringRegion(regionHandle, agentID, position, isFlying); | ||
2706 | } | ||
2707 | |||
2708 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) | 2680 | public void CrossAgentToNewRegion(ScenePresence agent, bool isFlying) |
2709 | { | 2681 | { |
2710 | m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); | 2682 | m_sceneGridService.CrossAgentToNewRegion(this, agent, isFlying); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 8271829..9a6bd87 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -99,7 +99,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
99 | 99 | ||
100 | m_regionInfo = regionInfos; | 100 | m_regionInfo = regionInfos; |
101 | m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; | 101 | m_commsProvider.GridService.gdebugRegionName = regionInfos.RegionName; |
102 | m_commsProvider.InterRegion.rdebugRegionName = regionInfos.RegionName; | ||
103 | regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); | 102 | regionCommsHost = m_commsProvider.GridService.RegisterRegion(m_regionInfo); |
104 | 103 | ||
105 | if (regionCommsHost != null) | 104 | if (regionCommsHost != null) |
@@ -1017,16 +1016,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1017 | { | 1016 | { |
1018 | return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); }); | 1017 | return previousNeighbours.FindAll(delegate(ulong handle) { return !currentNeighbours.Contains(handle); }); |
1019 | } | 1018 | } |
1020 | /// <summary> | ||
1021 | /// Inform a neighbouring region that an avatar is about to cross into it. | ||
1022 | /// </summary> | ||
1023 | /// <param name="regionhandle"></param> | ||
1024 | /// <param name="agentID"></param> | ||
1025 | /// <param name="position"></param> | ||
1026 | public bool CrossToNeighbouringRegion(ulong regionhandle, UUID agentID, Vector3 position, bool isFlying) | ||
1027 | { | ||
1028 | return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); | ||
1029 | } | ||
1030 | 1019 | ||
1031 | public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying) | 1020 | public void CrossAgentToNewRegion(Scene scene, ScenePresence agent, bool isFlying) |
1032 | { | 1021 | { |
@@ -1205,11 +1194,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1205 | } | 1194 | } |
1206 | 1195 | ||
1207 | 1196 | ||
1208 | public bool PrimCrossToNeighboringRegion(ulong regionhandle, UUID primID, string objData, int XMLMethod) | ||
1209 | { | ||
1210 | return m_commsProvider.InterRegion.InformRegionOfPrimCrossing(regionhandle, primID, objData, XMLMethod); | ||
1211 | } | ||
1212 | |||
1213 | public Dictionary<string, string> GetGridSettings() | 1197 | public Dictionary<string, string> GetGridSettings() |
1214 | { | 1198 | { |
1215 | return m_commsProvider.GridService.GetGridSettings(); | 1199 | return m_commsProvider.GridService.GetGridSettings(); |