Ejemplo n.º 1
0
        public void OnRegisterCaps(UUID agentID, Caps caps)
        {
            // Register an event queue for the client

            m_log.DebugFormat(
                "[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
                agentID, caps, m_scene.RegionInfo.RegionName);

            // Let's instantiate a Queue for this agent right now
            TryGetQueue(agentID);

            UUID eventQueueGetUUID;

            eventQueueGetUUID = m_AvatarQueueUUIDMapping.GetOrAddIfNotExists(agentID, delegate() { return(UUID.Random()); });

            m_QueueUUIDAvatarMapping[eventQueueGetUUID] = agentID;
            m_AvatarQueueUUIDMapping[agentID]           = eventQueueGetUUID;

            caps.RegisterPollHandler(
                "EventQueueGet",
                new PollServiceEventArgs(null, GenerateEqgCapPath(eventQueueGetUUID), HasEvents, GetEvents, NoEvents, agentID, SERVER_EQ_TIME_NO_EVENTS));

            Random rnd = new Random(Environment.TickCount);

            try
            {
                m_ids.AddIfNotExists(agentID, delegate() { return(rnd.Next(30000000)); });
            }
            catch (ThreadedClasses.RwLockedDictionary <UUID, int> .KeyAlreadyExistsException)
            {
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Cache the friends list or increment the refcount for the existing friends list.
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <returns>
        /// Returns true if the list was fetched, false if it wasn't
        /// </returns>
        protected virtual bool CacheFriends(IClientAPI client)
        {
            bool           result = false;
            UserFriendData friendsData;
            UUID           agentID = client.AgentId;

            if (!m_Friends.TryGetValue(agentID, out friendsData))
            {
                /* better to do some unnecessary fetches outside of an WriterLock instead of trying to reduce that and locking up the FriendsModule */
                friendsData             = new UserFriendData();
                friendsData.PrincipalID = agentID;
                friendsData.Friends     = GetFriendsFromService(client);

                try
                {
                    m_Friends.AddIfNotExists(agentID, delegate()
                    {
                        result = true;
                        return(friendsData);
                    });
                }
                catch (ThreadedClasses.RwLockedDictionary <UUID, UserFriendData> .KeyAlreadyExistsException)
                {
                }
            }

            return(result);
        }
 public void AddUser(UUID uuid, string first, string last)
 {
     try
     {
         m_UserCache.AddIfNotExists(uuid, delegate()
         {
             UserData user         = new UserData();
             user.Id               = uuid;
             user.FirstName        = first;
             user.LastName         = last;
             user.IsUnknownUser    = false;
             user.HasGridUserTried = false;
             return(user);
         });
     }
     catch (ThreadedClasses.RwLockedDictionary <UUID, UserData> .KeyAlreadyExistsException)
     {
     }
 }
Ejemplo n.º 4
0
        public void AddRegion(Scene scene)
        {
            if (!m_Enabled)
            {
                return;
            }

            scene.RegisterModuleInterface <IGridService>(this);

            try
            {
                m_LocalCache.AddIfNotExists(scene.RegionInfo.RegionID, delegate() { return(new RegionCache(scene)); });
            }
            catch (ThreadedClasses.RwLockedDictionary <UUID, RegionCache> .KeyAlreadyExistsException)
            {
                m_log.ErrorFormat("[LOCAL GRID SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!");
            }
        }
 /// <summary>
 /// Create a new subfolder.
 /// </summary>
 /// <param name="folderID"></param>
 /// <param name="folderName"></param>
 /// <param name="type"></param>
 /// <returns>The newly created subfolder.  Returns null if the folder already exists</returns>
 public InventoryFolderImpl CreateChildFolder(UUID folderID, string folderName, ushort type)
 {
     try
     {
         return(m_childFolders.AddIfNotExists(folderID, delegate()
         {
             InventoryFolderImpl subFold = new InventoryFolderImpl();
             subFold.Name = folderName;
             subFold.ID = folderID;
             subFold.Type = (short)type;
             subFold.ParentID = this.ID;
             subFold.Owner = Owner;
             return subFold;
         }));
     }
     catch (ThreadedClasses.RwLockedDictionary <UUID, InventoryFolderImpl> .KeyAlreadyExistsException)
     {
         return(null);
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Register an already started HTTP server to the collection of known servers.
 /// </summary>
 /// <param name='server'></param>
 public static void AddHttpServer(BaseHttpServer server)
 {
     m_Servers.AddIfNotExists(server.Port, delegate() { return(server); });
 }