aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications/Hypergrid/HGGridServices.cs')
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServices.cs330
1 files changed, 1 insertions, 329 deletions
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