コード例 #1
0
        /// <summary>
        /// Does this user have a registered texture download service?
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="textureService"></param>
        /// <returns>A UserTextureDownloadService or null in the output parameter, and true or false accordingly.</returns>
        private bool TryGetUserTextureService(IClientAPI client, out UserTextureDownloadService textureService)
        {
            lock (m_userTextureServices)
            {
                if (m_userTextureServices.TryGetValue(client.AgentId, out textureService))
                {
                    //m_log.DebugFormat("[TEXTURE MODULE]: Found existing UserTextureServices in ", m_scene.RegionInfo.RegionName);
                    return(true);
                }

                textureService = null;
                return(false);
            }
        }
コード例 #2
0
        /// I'm commenting this out, and replacing it with the implementation below, which
        /// may return a null value. This is necessary for avoiding race conditions 
        /// recreating UserTextureServices for clients that have just been closed.
        /// That behavior of always returning a UserTextureServices was causing the
        /// A-B-A problem (mantis #2855).
        /// 
        ///// <summary>
        ///// Does this user have a registered texture download service?
        ///// </summary>
        ///// <param name="userID"></param>
        ///// <param name="textureService"></param>
        ///// <returns>Always returns true, since a service is created if one does not already exist</returns>
        //private bool TryGetUserTextureService(
        //    IClientAPI client, out UserTextureDownloadService textureService)
        //{
        //    lock (m_userTextureServices)
        //    {
        //        if (m_userTextureServices.TryGetValue(client.AgentId, out textureService))
        //        {
        //            //m_log.DebugFormat("[TEXTURE MODULE]: Found existing UserTextureServices in ", m_scene.RegionInfo.RegionName);
        //            return true;
        //        }

        //        m_log.DebugFormat("[TEXTURE MODULE]: Creating new UserTextureServices in ", m_scene.RegionInfo.RegionName);
        //        textureService = new UserTextureDownloadService(client, m_scene, m_queueSenders);
        //        m_userTextureServices.Add(client.AgentId, textureService);

        //        return true;
        //    }
        //}

        /// <summary>
        /// Does this user have a registered texture download service?
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="textureService"></param>
        /// <returns>A UserTextureDownloadService or null in the output parameter, and true or false accordingly.</returns>
        private bool TryGetUserTextureService(IClientAPI client, out UserTextureDownloadService textureService)
        {
            lock (m_userTextureServices)
            {
                if (m_userTextureServices.TryGetValue(client.AgentId, out textureService))
                {
                    //m_log.DebugFormat("[TEXTURE MODULE]: Found existing UserTextureServices in ", m_scene.RegionInfo.RegionName);
                    return true;
                }

                textureService = null;
                return false;
            }
        }