private bool IsLocalStandaloneUser(UUID userID)
        {
            if (m_userProfileCache == null)
            {
                return(false);
            }

            CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(userID);

            if (uinfo == null)
            {
                return(true);
            }

            string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);

            if ((!m_gridmode) && ((userInventoryServerURI == _inventoryServerUrl)) || (userInventoryServerURI == ""))
            {
                return(true);
            }
            return(false);
        }
示例#2
0
        private bool IsLocalGridUser(UUID userID)
        {
            if (m_UserProfileService == null)
            {
                return(false);
            }

            CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);

            if (uinfo == null)
            {
                return(true);
            }

            string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);

            if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == ""))
            {
                return(true);
            }
            return(false);
        }
示例#3
0
        public bool InformRegionOfUser(RegionInfo regInfo, AgentCircuitData agentData)
        {
            //ulong regionHandle = regInfo.RegionHandle;
            try
            {
                //regionHandle = Convert.ToUInt64(regInfo.regionSecret);
                m_log.Info("[HGrid]: InformRegionOfUser: Remote hyperlinked region " + regInfo.regionSecret);
            }
            catch
            {
                m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret);
            }

            string    capsPath    = agentData.CapsPath;
            Hashtable loginParams = new Hashtable();

            loginParams["session_id"]        = agentData.SessionID.ToString();
            loginParams["secure_session_id"] = agentData.SecureSessionID.ToString();

            loginParams["firstname"] = agentData.firstname;
            loginParams["lastname"]  = agentData.lastname;

            loginParams["agent_id"]     = agentData.AgentID.ToString();
            loginParams["circuit_code"] = agentData.circuitcode.ToString();
            loginParams["startpos_x"]   = agentData.startpos.X.ToString();
            loginParams["startpos_y"]   = agentData.startpos.Y.ToString();
            loginParams["startpos_z"]   = agentData.startpos.Z.ToString();
            loginParams["caps_path"]    = capsPath;

            CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID);

            if (u != null && u.UserProfile != null)
            {
                loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero
                //m_log.Debug("  --------- Home Region UUID -------");
                //m_log.Debug("  >> " + loginParams["region_uuid"] + " <<");
                //m_log.Debug("  --------- ---------------- -------");

                string serverURI = "";
                if (u.UserProfile is ForeignUserProfileData)
                {
                    serverURI = HGNetworkServersInfo.ServerURI(((ForeignUserProfileData)u.UserProfile).UserServerURI);
                }
                loginParams["userserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalUserServerURI : serverURI;

                serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserAssetURI);
                loginParams["assetserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalAssetServerURI : serverURI;

                serverURI = HGNetworkServersInfo.ServerURI(u.UserProfile.UserInventoryURI);
                loginParams["inventoryserver_id"] = (serverURI == "") || (serverURI == null) ? HGNetworkServersInfo.Singleton.LocalInventoryServerURI : serverURI;

                loginParams["root_folder_id"] = u.UserProfile.RootInventoryFolderID;

                RegionInfo rinfo = RequestNeighbourInfo(u.UserProfile.HomeRegion);
                if (rinfo != null)
                {
                    loginParams["internal_port"] = rinfo.InternalEndPoint.Port.ToString();
                    if (!IsLocalUser(u))
                    {
                        loginParams["regionhandle"] = rinfo.regionSecret; // user.CurrentAgent.Handle.ToString();
                        //m_log.Debug("XXX--- informregionofuser (foreign user) here handle: " + rinfo.regionSecret);

                        loginParams["home_address"]  = ((ForeignUserProfileData)(u.UserProfile)).UserHomeAddress;
                        loginParams["home_port"]     = ((ForeignUserProfileData)(u.UserProfile)).UserHomePort;
                        loginParams["home_remoting"] = ((ForeignUserProfileData)(u.UserProfile)).UserHomeRemotingPort;
                    }
                    else
                    {
                        //m_log.Debug("XXX--- informregionofuser (local user) here handle: " + rinfo.regionSecret);

                        //// local user about to jump out, let's process the name
                        // On second thoughts, let's not do this for the *user*; let's only do it for the *agent*
                        //loginParams["firstname"] = agentData.firstname + "." + agentData.lastname;
                        //loginParams["lastname"] = serversInfo.UserURL;

                        // local user, first time out. let's ask the grid about this user's home region
                        loginParams["regionhandle"] = u.UserProfile.HomeRegion.ToString(); // user.CurrentAgent.Handle.ToString();

                        loginParams["home_address"] = rinfo.ExternalHostName;
                        m_log.Debug("  --------- Home Address -------");
                        m_log.Debug("  >> " + loginParams["home_address"] + " <<");
                        m_log.Debug("  --------- ------------ -------");
                        loginParams["home_port"]     = rinfo.HttpPort.ToString();
                        loginParams["home_remoting"] = ConfigSettings.DefaultRegionRemotingPort.ToString();;
                    }
                }
                else
                {
                    m_log.Warn("[HGrid]: User's home region info not found: " + u.UserProfile.HomeRegionX + ", " + u.UserProfile.HomeRegionY);
                }
            }

            ArrayList SendParams = new ArrayList();

            SendParams.Add(loginParams);

            // Send
            string uri = "http://" + regInfo.ExternalHostName + ":" + regInfo.HttpPort + "/";
            //m_log.Debug("XXX uri: " + uri);
            XmlRpcRequest  request = new XmlRpcRequest("expect_hg_user", SendParams);
            XmlRpcResponse reply;

            try
            {
                reply = request.Send(uri, 6000);
            }
            catch (Exception e)
            {
                m_log.Warn("[HGrid]: Failed to notify region about user. Reason: " + e.Message);
                return(false);
            }

            if (!reply.IsFault)
            {
                bool responseSuccess = true;
                if (reply.Value != null)
                {
                    Hashtable resp = (Hashtable)reply.Value;
                    if (resp.ContainsKey("success"))
                    {
                        if ((string)resp["success"] == "FALSE")
                        {
                            responseSuccess = false;
                        }
                    }
                }
                if (responseSuccess)
                {
                    m_log.Info("[HGrid]: Successfully informed remote region about user " + agentData.AgentID);
                    return(true);
                }
                else
                {
                    m_log.ErrorFormat("[HGrid]: Region responded that it is not available to receive clients");
                    return(false);
                }
            }
            else
            {
                m_log.ErrorFormat("[HGrid]: XmlRpc request to region failed with message {0}, code {1} ", reply.FaultString, reply.FaultCode);
                return(false);
            }
        }