diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | 195 |
1 files changed, 107 insertions, 88 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs index 501f730..3c1f7b6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs | |||
@@ -38,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; | |||
38 | using OpenSim.Region.Framework.Scenes.Hypergrid; | 38 | using OpenSim.Region.Framework.Scenes.Hypergrid; |
39 | using OpenSim.Services.Interfaces; | 39 | using OpenSim.Services.Interfaces; |
40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | 40 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; |
41 | using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; | ||
41 | using OpenSim.Server.Base; | 42 | using OpenSim.Server.Base; |
42 | using OpenSim.Services.Connectors.Grid; | 43 | using OpenSim.Services.Connectors.Grid; |
43 | using OpenSim.Framework.Console; | 44 | using OpenSim.Framework.Console; |
@@ -603,93 +604,105 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
603 | 604 | ||
604 | public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData) | 605 | public bool SendUserInformation(GridRegion regInfo, AgentCircuitData agentData) |
605 | { | 606 | { |
606 | CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID); | 607 | // REFACTORING PROBLEM. This needs to change. Some of this info should go with the agent circuit data. |
607 | 608 | ||
608 | if (uinfo == null) | 609 | //UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, agentData.AgentID); |
609 | return false; | 610 | //if (account == null) |
610 | 611 | // return false; | |
611 | if ((IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) || | ||
612 | (!IsLocalUser(uinfo) && !IsGoingHome(uinfo, regInfo))) | ||
613 | { | ||
614 | m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere"); | ||
615 | |||
616 | // Set the position of the region on the remote grid | ||
617 | // ulong realHandle = FindRegionHandle(regInfo.RegionHandle); | ||
618 | uint x = 0, y = 0; | ||
619 | Utils.LongToUInts(regInfo.RegionHandle, out x, out y); | ||
620 | GridRegion clonedRegion = new GridRegion(regInfo); | ||
621 | clonedRegion.RegionLocX = (int)x; | ||
622 | clonedRegion.RegionLocY = (int)y; | ||
623 | |||
624 | // Get the user's home region information and adapt the region handle | ||
625 | GridRegion home = GetRegionByUUID(m_aScene.RegionInfo.ScopeID, uinfo.UserProfile.HomeRegionID); | ||
626 | if (m_HyperlinkHandles.ContainsKey(uinfo.UserProfile.HomeRegionID)) | ||
627 | { | ||
628 | ulong realHandle = m_HyperlinkHandles[uinfo.UserProfile.HomeRegionID]; | ||
629 | Utils.LongToUInts(realHandle, out x, out y); | ||
630 | m_log.DebugFormat("[HGrid]: Foreign user is going elsewhere. Adjusting home handle from {0}-{1} to {2}-{3}", home.RegionLocX, home.RegionLocY, x, y); | ||
631 | home.RegionLocX = (int)x; | ||
632 | home.RegionLocY = (int)y; | ||
633 | } | ||
634 | 612 | ||
635 | // Get the user's service URLs | 613 | //if ((IsLocalUser(account) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) || |
636 | string serverURI = ""; | 614 | // (!IsLocalUser(account) && !IsGoingHome(uinfo, regInfo))) |
637 | if (uinfo.UserProfile is ForeignUserProfileData) | ||
638 | serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | ||
639 | string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI; | ||
640 | |||
641 | string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI); | ||
642 | if ((assetServer == null) || (assetServer == "")) | ||
643 | assetServer = LocalAssetServerURI; | ||
644 | |||
645 | string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); | ||
646 | if ((inventoryServer == null) || (inventoryServer == "")) | ||
647 | inventoryServer = LocalInventoryServerURI; | ||
648 | |||
649 | if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer)) | ||
650 | { | ||
651 | m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | ||
652 | return false; | ||
653 | } | ||
654 | } | ||
655 | //if ((uinfo == null) || !IsGoingHome(uinfo, regInfo)) | ||
656 | //{ | 615 | //{ |
657 | // m_log.Info("[HGrid]: User seems to be going to foreign region."); | 616 | // m_log.Info("[HGrid]: Local user is going to foreign region or foreign user is going elsewhere"); |
658 | // if (!InformRegionOfUser(regInfo, agentData)) | 617 | |
618 | // PresenceInfo pinfo = m_aScene.PresenceService.GetAgent(agentData.SessionID); | ||
619 | // if (pinfo != null) | ||
620 | // { | ||
621 | // // Set the position of the region on the remote grid | ||
622 | // // ulong realHandle = FindRegionHandle(regInfo.RegionHandle); | ||
623 | // uint x = 0, y = 0; | ||
624 | // Utils.LongToUInts(regInfo.RegionHandle, out x, out y); | ||
625 | // GridRegion clonedRegion = new GridRegion(regInfo); | ||
626 | // clonedRegion.RegionLocX = (int)x; | ||
627 | // clonedRegion.RegionLocY = (int)y; | ||
628 | |||
629 | // // Get the user's home region information and adapt the region handle | ||
630 | // GridRegion home = GetRegionByUUID(m_aScene.RegionInfo.ScopeID, pinfo.HomeRegionID); | ||
631 | // if (m_HyperlinkHandles.ContainsKey(pinfo.HomeRegionID)) | ||
632 | // { | ||
633 | // ulong realHandle = m_HyperlinkHandles[pinfo.HomeRegionID]; | ||
634 | // Utils.LongToUInts(realHandle, out x, out y); | ||
635 | // m_log.DebugFormat("[HGrid]: Foreign user is going elsewhere. Adjusting home handle from {0}-{1} to {2}-{3}", home.RegionLocX, home.RegionLocY, x, y); | ||
636 | // home.RegionLocX = (int)x; | ||
637 | // home.RegionLocY = (int)y; | ||
638 | // } | ||
639 | |||
640 | // // Get the user's service URLs | ||
641 | // string serverURI = ""; | ||
642 | // if (uinfo.UserProfile is ForeignUserProfileData) | ||
643 | // serverURI = Util.ServerURI(((ForeignUserProfileData)uinfo.UserProfile).UserServerURI); | ||
644 | // string userServer = (serverURI == "") || (serverURI == null) ? LocalUserServerURI : serverURI; | ||
645 | |||
646 | // string assetServer = Util.ServerURI(uinfo.UserProfile.UserAssetURI); | ||
647 | // if ((assetServer == null) || (assetServer == "")) | ||
648 | // assetServer = LocalAssetServerURI; | ||
649 | |||
650 | // string inventoryServer = Util.ServerURI(uinfo.UserProfile.UserInventoryURI); | ||
651 | // if ((inventoryServer == null) || (inventoryServer == "")) | ||
652 | // inventoryServer = LocalInventoryServerURI; | ||
653 | |||
654 | // if (!m_HypergridServiceConnector.InformRegionOfUser(clonedRegion, agentData, home, userServer, assetServer, inventoryServer)) | ||
655 | // { | ||
656 | // m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | ||
657 | // return false; | ||
658 | // } | ||
659 | // } | ||
660 | // else | ||
659 | // { | 661 | // { |
660 | // m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); | 662 | // m_log.Warn("[HGrid]: Unable to find local presence of transferring user."); |
661 | // return false; | 663 | // return false; |
662 | // } | 664 | // } |
663 | //} | 665 | //} |
664 | //else | 666 | ////if ((uinfo == null) || !IsGoingHome(uinfo, regInfo)) |
665 | // m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | 667 | ////{ |
666 | 668 | //// m_log.Info("[HGrid]: User seems to be going to foreign region."); | |
667 | // May need to change agent's name | 669 | //// if (!InformRegionOfUser(regInfo, agentData)) |
668 | if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) | 670 | //// { |
669 | { | 671 | //// m_log.Warn("[HGrid]: Could not inform remote region of transferring user."); |
670 | agentData.firstname = agentData.firstname + "." + agentData.lastname; | 672 | //// return false; |
671 | agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI; | 673 | //// } |
672 | } | 674 | ////} |
675 | ////else | ||
676 | //// m_log.Info("[HGrid]: User seems to be going home " + uinfo.UserProfile.FirstName + " " + uinfo.UserProfile.SurName); | ||
677 | |||
678 | //// May need to change agent's name | ||
679 | //if (IsLocalUser(uinfo) && (GetHyperlinkRegion(regInfo.RegionHandle) != null)) | ||
680 | //{ | ||
681 | // agentData.firstname = agentData.firstname + "." + agentData.lastname; | ||
682 | // agentData.lastname = "@" + LocalUserServerURI.Replace("http://", ""); ; //HGNetworkServersInfo.Singleton.LocalUserServerURI; | ||
683 | //} | ||
673 | 684 | ||
674 | return true; | 685 | return true; |
675 | } | 686 | } |
676 | 687 | ||
677 | public void AdjustUserInformation(AgentCircuitData agentData) | 688 | public void AdjustUserInformation(AgentCircuitData agentData) |
678 | { | 689 | { |
679 | CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID); | 690 | // REFACTORING PROBLEM!!! This needs to change |
680 | if ((uinfo != null) && (uinfo.UserProfile != null) && | 691 | |
681 | (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) | 692 | //CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(agentData.AgentID); |
682 | { | 693 | //if ((uinfo != null) && (uinfo.UserProfile != null) && |
683 | //m_log.Debug("---------------> Local User!"); | 694 | // (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) |
684 | string[] parts = agentData.firstname.Split(new char[] { '.' }); | 695 | //{ |
685 | if (parts.Length == 2) | 696 | // //m_log.Debug("---------------> Local User!"); |
686 | { | 697 | // string[] parts = agentData.firstname.Split(new char[] { '.' }); |
687 | agentData.firstname = parts[0]; | 698 | // if (parts.Length == 2) |
688 | agentData.lastname = parts[1]; | 699 | // { |
689 | } | 700 | // agentData.firstname = parts[0]; |
690 | } | 701 | // agentData.lastname = parts[1]; |
691 | //else | 702 | // } |
692 | // m_log.Debug("---------------> Foreign User!"); | 703 | //} |
704 | ////else | ||
705 | //// m_log.Debug("---------------> Foreign User!"); | ||
693 | } | 706 | } |
694 | 707 | ||
695 | // Check if a local user exists with the same UUID as the incoming foreign user | 708 | // Check if a local user exists with the same UUID as the incoming foreign user |
@@ -699,16 +712,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
699 | if (!m_aScene.SceneGridService.RegionLoginsEnabled) | 712 | if (!m_aScene.SceneGridService.RegionLoginsEnabled) |
700 | return false; | 713 | return false; |
701 | 714 | ||
702 | CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 715 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID); |
703 | if (uinfo != null) | 716 | if (account != null) |
704 | { | 717 | { |
705 | // uh-oh we have a potential intruder | 718 | if (m_aScene.AuthenticationService.Verify(userID, sessionID.ToString(), 30)) |
706 | if (uinfo.SessionID != sessionID) | 719 | { |
707 | // can't have a foreigner with a local UUID | ||
708 | return false; | ||
709 | else | ||
710 | // oh, so it's you! welcome back | 720 | // oh, so it's you! welcome back |
711 | comingHome = true; | 721 | comingHome = true; |
722 | } | ||
723 | else | ||
724 | // can't have a foreigner with a local UUID | ||
725 | return false; | ||
712 | } | 726 | } |
713 | 727 | ||
714 | // OK, user can come in | 728 | // OK, user can come in |
@@ -717,7 +731,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
717 | 731 | ||
718 | public void AcceptUser(ForeignUserProfileData user, GridRegion home) | 732 | public void AcceptUser(ForeignUserProfileData user, GridRegion home) |
719 | { | 733 | { |
720 | m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user); | 734 | // REFACTORING PROBLEM. uh-oh, commenting this breaks HG completely |
735 | // Needs to be rewritten | ||
736 | //m_aScene.CommsManager.UserProfileCacheService.PreloadUserCache(user); | ||
737 | |||
721 | ulong realHandle = home.RegionHandle; | 738 | ulong realHandle = home.RegionHandle; |
722 | // Change the local coordinates | 739 | // Change the local coordinates |
723 | // X=0 on the map | 740 | // X=0 on the map |
@@ -733,8 +750,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
733 | 750 | ||
734 | public bool IsLocalUser(UUID userID) | 751 | public bool IsLocalUser(UUID userID) |
735 | { | 752 | { |
736 | CachedUserInfo uinfo = m_aScene.CommsManager.UserProfileCacheService.GetUserDetails(userID); | 753 | UserAccount account = m_aScene.UserAccountService.GetUserAccount(m_aScene.RegionInfo.ScopeID, userID); |
737 | return IsLocalUser(uinfo); | 754 | return IsLocalUser(account); |
738 | } | 755 | } |
739 | 756 | ||
740 | #endregion | 757 | #endregion |
@@ -767,13 +784,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
767 | return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID); | 784 | return (uinfo.UserProfile.HomeRegionID == rinfo.RegionID); |
768 | } | 785 | } |
769 | 786 | ||
770 | protected bool IsLocalUser(CachedUserInfo uinfo) | 787 | protected bool IsLocalUser(UserAccount account) |
771 | { | 788 | { |
772 | if (uinfo == null) | 789 | if (account != null && |
773 | return false; | 790 | account.ServiceURLs.ContainsKey("HomeURI") && |
791 | account.ServiceURLs["HomeURI"] != null) | ||
774 | 792 | ||
775 | return !(uinfo.UserProfile is ForeignUserProfileData); | 793 | return (account.ServiceURLs["HomeURI"].ToString() == LocalUserServerURI); |
776 | 794 | ||
795 | return false; | ||
777 | } | 796 | } |
778 | 797 | ||
779 | 798 | ||