Esempio n. 1
0
 /* setting value to null will delete the entry */
 WindLightSettings ISimulationDataEnvSettingsStorageInterface.this[UUID regionID]
 {
     get
     {
         WindLightSettings settings;
         if (!EnvironmentSettings.TryGetValue(regionID, out settings))
         {
             throw new KeyNotFoundException();
         }
         return(settings);
     }
     set
     {
         if (value == null)
         {
             m_EnvSettingsData.Remove(regionID);
         }
         else
         {
             using (var ms = new MemoryStream())
             {
                 value.Serialize(ms, regionID);
                 m_EnvSettingsData[regionID] = ms.ToArray();
             }
         }
     }
 }
 void IGroupMembersInterface.Delete(UGUI requestingAgent, UGI group, UGUI principal)
 {
     Members.Delete(requestingAgent, group, principal);
     m_PrincipalGroupMemberCache.Remove(new UGUI_UGUI {
         RequestingAgent = requestingAgent, Principal = principal
     });
     m_GroupMemberCache.Remove(new UGUI_UGI {
         RequestingAgent = requestingAgent, Group = group
     });
 }
        private void HandleImageNotInDatabase(Message m, ViewerConnection vc, ViewerAgentAccessor agent)
        {
            ImageNotInDatabase res = (ImageNotInDatabase)m;

            m_ActiveImageTransfers.Remove(res.ID);
            vc.PostEvent(new TextureReceivedEvent
            {
                Agent     = agent,
                TextureID = res.ID,
                Success   = 0,
                Data      = new ByteArrayApi.ByteArray()
            });
        }
        void IInventoryFolderServiceInterface.Move(UUID principalID, UUID folderID, UUID toFolderID)
        {
            var req = new MoveInventoryFolder
            {
                AgentID   = m_ViewerCircuit.AgentID,
                SessionID = m_ViewerCircuit.SessionID
            };

            req.InventoryData.Add(new MoveInventoryFolder.InventoryDataEntry
            {
                FolderID = folderID,
                ParentID = toFolderID
            });
            var autoEvent = new AutoResetEvent(false);

            try
            {
                m_WaitMoveFolder.Add(folderID, autoEvent);
                m_ViewerCircuit.SendMessage(req);
                if (!autoEvent.WaitOne(5000))
                {
                    throw new InventoryFolderNotStoredException();
                }
            }
            finally
            {
                m_WaitMoveFolder.Remove(folderID);
            }
        }
Esempio n. 5
0
 public void RemoveLocalization(string culturename)
 {
     if (m_NamedLocalizations.Remove(culturename))
     {
         TriggerOnUpdate(UpdateChangedFlags.Texture);
     }
 }
        void IInventoryFolderServiceInterface.Update(InventoryFolder folder)
        {
            var req = new UpdateInventoryFolder
            {
                AgentID   = m_ViewerCircuit.AgentID,
                SessionID = m_ViewerCircuit.SessionID,
            };

            req.InventoryData.Add(new UpdateInventoryFolder.InventoryDataEntry
            {
                FolderID    = folder.ID,
                Name        = folder.Name,
                ParentID    = folder.ParentFolderID,
                DefaultType = folder.DefaultType
            });
            var autoEvent = new AutoResetEvent(false);

            try
            {
                m_WaitUpdateFolder.Add(folder.ID, autoEvent);
                m_ViewerCircuit.SendMessage(req);
                if (!autoEvent.WaitOne(5000))
                {
                    throw new InventoryFolderNotStoredException();
                }
            }
            finally
            {
                m_WaitUpdateFolder.Remove(folder.ID);
            }
        }
        public void CleanupTimer(object sender, ElapsedEventArgs e)
        {
            var removeList           = new List <string>();
            var removeClassifiedList = new List <UUID>();

            foreach (KeyValuePair <string, ProfileServiceData> kvp in m_LastKnownProfileServices)
            {
                if (Environment.TickCount - kvp.Value.TicksAt > 60000)
                {
                    removeList.Add(kvp.Key);
                }
            }
            foreach (string rem in removeList)
            {
                m_LastKnownProfileServices.Remove(rem);
            }

            /* remove classifieds query caches after half an hour */
            foreach (var kvp in m_ClassifiedQueryCache)
            {
                if (Environment.TickCount - kvp.Value.Value > 1800000)
                {
                    removeClassifiedList.Add(kvp.Key);
                }
            }
            foreach (var classifiedid in removeClassifiedList)
            {
                m_ClassifiedQueryCache.Remove(classifiedid);
            }
        }
        public void HandleConfirmXferPacket(Message m)
        {
            var req = (ConfirmXferPacket)m;
            DownloadTransferData tdata;

            if (m_DownloadTransfersByXferID.TryGetValue(req.ID, out tdata))
            {
                if (tdata.Packet != req.Packet || tdata.Position == 0)
                {
                    return;
                }

                var res = new SendXferPacket
                {
                    Packet = ++tdata.Packet
                };
                int remaininglength = tdata.Data.Length - tdata.Position;
                if (remaininglength > 1400)
                {
                    res.Data = new byte[1400];
                    Buffer.BlockCopy(tdata.Data, tdata.Position, res.Data, 0, 1400);
                    tdata.Position += 1400;
                }
                else
                {
                    res.Data = new byte[remaininglength];
                    Buffer.BlockCopy(tdata.Data, tdata.Position, res.Data, 0, remaininglength);
                    m_DownloadTransfersByXferID.Remove(req.ID);
                    m_DownloadTransfersByName.Remove(tdata.Filename);
                    res.Packet |= 0x80000000;
                }
                res.ID = tdata.XferID;
                SendMessageAlways(res, req.CircuitSceneID);
            }
        }
Esempio n. 9
0
        public override void NotifyNeighborStatus(RegionInfo fromRegion)
        {
            SceneInterface fromScene;

            if (m_Scenes.TryGetValue(fromRegion.ID, out fromScene))
            {
                if ((fromRegion.Flags & RegionFlags.RegionOnline) != 0)
                {
                    m_NeighborLists.GetOrAddIfNotExists(fromRegion.ID, () => new NeighborList());
                    foreach (RegionInfo neighbor in NeighborRequester.GetNeighbors(fromScene.GridService, fromRegion))
                    {
                        SceneInterface scene;
                        if (m_Scenes.TryGetValue(neighbor.ID, out scene))
                        {
                            scene.NotifyNeighborOnline(fromRegion);
                        }
                    }
                }
                else
                {
                    NeighborList list;
                    if (m_NeighborLists.Remove(fromRegion.ID, out list))
                    {
                        foreach (UUID id in list.Keys)
                        {
                            SceneInterface scene;
                            if (m_Scenes.TryGetValue(id, out scene))
                            {
                                scene.NotifyNeighborOffline(fromRegion);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        byte[] ISimulationDataEnvControllerStorageInterface.this[UUID regionID]
        {
            get { return(m_EnvControllerData[regionID]); }

            set
            {
                if (value != null)
                {
                    m_EnvControllerData[regionID] = value;
                }
                else
                {
                    m_EnvControllerData.Remove(regionID);
                }
            }
        }
 private void ExpireHandler(object o, ElapsedEventArgs args)
 {
     try
     {
         foreach (UUID id in m_NameCache.Keys)
         {
             ExperienceBrokerEntry entry;
             if (m_NameCache.TryGetValue(id, out entry))
             {
                 if (m_ClockSource.TicksElapsed(m_ClockSource.TickCount, entry.ExpiryTickCount) > m_ClockSource.SecsToTicks(120))
                 {
                     m_NameCache.Remove(id);
                 }
                 else
                 {
                     entry.ExpireHandler();
                 }
             }
         }
     }
     catch
     {
         /* do not pass these to timer handler */
     }
 }
Esempio n. 12
0
        public void Remove(UUID accountID)
        {
            m_AuthInfos.Remove(accountID);
            var tokenIds = new List <UUID>();

            foreach (var kvp in m_Tokens)
            {
                if (kvp.Value.UserID == accountID)
                {
                    tokenIds.Add(kvp.Key);
                }
            }
            foreach (UUID id in tokenIds)
            {
                m_Tokens.Remove(id);
            }
        }
 protected override void OnUpdate(ObjectUpdateInfo info)
 {
     if (info.IsKilled)
     {
         m_Primitives.Remove(info.ID);
         m_Objects.Remove(info.ID);
     }
     else
     {
         m_Objects.Remove(info.ID);
         m_Primitives[info.ID] = GenerateUpdateObjectPart(info.Part);
         m_Objects[info.ID]    = GenerateUpdateObjectGroup(info.Part.ObjectGroup);
         foreach (ObjectPartInventoryItem item in info.Part.Inventory.Values)
         {
             OnUpdate(item.UpdateInfo);
         }
     }
 }
Esempio n. 14
0
        bool IInventoryItemServiceInterface.TryGetValue(UUID principalID, UUID key, out InventoryItem item)
        {
            var req = new FetchInventory
            {
                AgentID   = m_ViewerCircuit.AgentID,
                SessionID = m_ViewerCircuit.SessionID,
            };

            req.InventoryData.Add(new FetchInventory.InventoryDataEntry
            {
                ItemID  = key,
                OwnerID = principalID
            });

            var listener = new FetchInventoryListener();

            m_FetchInventoryReply[key] = listener;
            m_ViewerCircuit.SendMessage(req);

            if (!listener.Event.WaitOne(5000))
            {
                throw new InventoryItemNotFoundException(key);
            }
            m_FetchInventoryReply.Remove(key);
            if (listener.Reply == null)
            {
                throw new InventoryItemNotFoundException(key);
            }

            FetchInventoryReply.ItemDataEntry d = listener.Reply.ItemData[0];

            item = new InventoryItem(d.ItemID)
            {
                Name     = d.Name,
                SaleInfo = new InventoryItem.SaleInfoData
                {
                    Price = d.SalePrice,
                    Type  = d.SaleType
                },
                Flags          = d.Flags,
                InventoryType  = d.InvType,
                AssetType      = d.Type,
                AssetID        = d.AssetID,
                IsGroupOwned   = d.IsGroupOwned,
                Group          = new UGI(d.GroupID),
                Owner          = new UGUI(d.OwnerID),
                Creator        = new UGUI(d.CreatorID),
                ParentFolderID = d.FolderID,
                Description    = d.Description
            };
            item.Permissions.NextOwner = d.NextOwnerMask;
            item.Permissions.EveryOne  = d.EveryoneMask;
            item.Permissions.Group     = d.GroupMask;
            item.Permissions.Current   = d.OwnerMask;
            item.Permissions.Base      = d.BaseMask;
            return(true);
        }
Esempio n. 15
0
        public void RemoveCircuit(Circuit c)
        {
            var ac = c as AgentCircuit;

            if (ac != null)
            {
                m_Agents.Remove(ac.AgentID);
            }
            m_Circuits.Remove(c.RemoteEndPoint, c.CircuitCode);
        }
Esempio n. 16
0
        public void RemoveObjectBuyListen(ScriptInstance instance)
        {
            ObjectPart part = instance.Part;
            ObjectPartInventoryItem item = instance.Item;

            if (part != null && item != null)
            {
                UUID partID = part.ID;
                UUID itemID = item.ID;
                m_ObjectBuyListeners.Remove(ObjectBuyListen.GetKey(partID, itemID));
            }
        }
Esempio n. 17
0
 public void OnTimer(object source, ElapsedEventArgs e)
 {
     foreach (KeyValuePair <UUID, int> kvp in m_LastAccessed)
     {
         if (Environment.TickCount - kvp.Value > 30000)
         {
             /* no need for locking here since we take out the last accessed first */
             m_LastAccessed.Remove(kvp.Key);
             m_Notecards.Remove(kvp.Key);
         }
     }
 }
            protected override void OnUpdate(ObjectInventoryUpdateInfo info)
            {
                string key = GenItemKey(info.PartID, info.ItemID);

                if (info.IsRemoved)
                {
                    m_PrimItems.Remove(key);
                }
                else
                {
                    m_PrimItems[key] = GenerateUpdateObjectPartInventoryItem(info.PartID, info.Item);
                }
            }
        public void HandleRequestXfer(Message m)
        {
            var req = (RequestXfer)m;
            DownloadTransferData tdata;

            if (m_DownloadTransfersByName.TryGetValue(req.Filename, out tdata))
            {
                if (tdata.Position != 0)
                {
                    return;
                }

                var res = new SendXferPacket();
                tdata.XferID = req.ID;
                if (tdata.Data.Length > 1400)
                {
                    res.Data = new byte[1400 + 4];
                    Buffer.BlockCopy(tdata.Data, 0, res.Data, 4, 1400);
                    tdata.Position += 1400;
                    m_DownloadTransfersByXferID.Add(tdata.XferID, tdata);
                    res.Packet = 0;
                }
                else
                {
                    res.Data = new byte[tdata.Data.Length + 4];
                    Buffer.BlockCopy(tdata.Data, 0, res.Data, 4, tdata.Data.Length);
                    m_DownloadTransfersByName.Remove(req.Filename);
                    tdata.Position += res.Data.Length;
                    res.Packet      = 0x80000000;
                }
                res.Data[0] = (byte)(tdata.Data.Length & 0xFF);
                res.Data[1] = (byte)((tdata.Data.Length >> 8) & 0xFF);
                res.Data[2] = (byte)((tdata.Data.Length >> 16) & 0xFF);
                res.Data[3] = (byte)((tdata.Data.Length >> 24) & 0xFF);
                res.ID      = tdata.XferID;
                SendMessageAlways(res, req.CircuitSceneID);
            }
        }
Esempio n. 20
0
        private void OnSceneRemoved(SceneInterface scene)
        {
            scene.LoginControl.OnLoginsEnabled -= LoginControl_OnLoginsEnabled;
            m_KnownScenes.Remove(scene.ID);
            var removeList = new Dictionary <UUID, NpcAgent>();

            foreach (NpcAgent agent in m_NpcAgents.Values)
            {
                if (agent.CurrentScene == scene)
                {
                    try
                    {
                        agent.DetachAllAttachments();
                    }
                    catch
                    {
                        m_Log.WarnFormat("Failed to detach attachments of NPC {0} {1} ({2})", agent.NamedOwner.FirstName, agent.NamedOwner.LastName, agent.NamedOwner.ID);
                    }
                    removeList.Add(agent.ID, agent);
                }
            }

            foreach (KeyValuePair <UUID, NpcAgent> kvp in removeList)
            {
                /* we have to call the next two removes explicitly. We only want to act upon non-persisted data */
                m_NonpersistentInventoryService.Remove(kvp.Key);
                m_NonpersistentProfileService?.Remove(kvp.Key);
                NpcAgent npc          = kvp.Value;
                IObject  obj          = npc.SittingOnObject;
                var      presenceInfo = new NpcPresenceInfo
                {
                    Npc               = npc.NamedOwner,
                    Owner             = npc.NpcOwner,
                    Position          = npc.Position,
                    LookAt            = npc.LookAt,
                    Group             = npc.Group,
                    RegionID          = npc.SceneID,
                    SittingOnObjectID = obj != null ? obj.ID : UUID.Zero
                };
                kvp.Value.DisableListen();

                if (m_NpcAgents.Remove(kvp.Key))
                {
                    /* we do not distinguish persistent/non-persistent here since NpcAgent has a property for referencing it */
                    npc.NpcPresenceService.Store(presenceInfo);
                }
            }
        }
Esempio n. 21
0
        private void CleanDestinationCache()
        {
            var regionHandles = new List <ulong>();

            foreach (var kvp in m_InterGridDestinations)
            {
                if (Date.GetUnixTime() - kvp.Value.Key > 240)
                {
                    regionHandles.Add(kvp.Key);
                }
            }
            foreach (ulong r in regionHandles)
            {
                m_InterGridDestinations.Remove(r);
            }
        }
Esempio n. 22
0
 public static void Remove(UUID assetID, ScriptInstance instance) => m_CompilerLock.AcquireWriterLock(() =>
 {
     if (m_LoadedInstances.RemoveIf(assetID, (RwLockedList <ScriptInstance> list) =>
     {
         list.Remove(instance);
         return(list.Count == 0);
     }))
     {
         m_LoadedAssemblies.Remove(assetID);
         AppDomain appDom;
         if (m_LoadedDomains.Remove(assetID, out appDom))
         {
             AppDomain.Unload(appDom);
         }
     }
 });
Esempio n. 23
0
        private void CacheFriends()
        {
            lock (m_KnownFriendsCacheLock)
            {
                if (!m_KnownFriendsCached)
                {
                    if (FriendsService != null)
                    {
                        if (m_KnownFriends.Count == 0)
                        {
                            foreach (FriendInfo fi in FriendsService[Owner])
                            {
                                m_KnownFriends.Add(fi.Friend.ID, new FriendStatus(fi));
                            }
                        }
                    }
                    else
                    {
                        /* if we have already some entries, we keep the ones that are still valid */
                        var haveIDs = new List <UUID>(m_KnownFriends.Keys);
                        foreach (var fi in FriendsService[Owner])
                        {
                            FriendStatus fStat;
                            if (m_KnownFriends.TryGetValue(fi.Friend.ID, out fStat))
                            {
                                fStat.FriendGivenFlags = fi.FriendGivenFlags;
                                fStat.UserGivenFlags   = fi.UserGivenFlags;
                            }
                            else
                            {
                                m_KnownFriends.Add(fi.Friend.ID, new FriendStatus(fi));
                            }
                            haveIDs.Remove(fi.Friend.ID);
                        }

                        foreach (var id in haveIDs)
                        {
                            m_KnownFriends.Remove(id);
                        }
                    }
                    m_KnownFriendsCached = true;
                }
            }
        }
        public override bool Remove(UGUI requestingAgent, UEI id)
        {
            ExperienceInfo info;

            if (!m_Experiences.TryGetValue(id.ID, out info))
            {
                return(false);
            }
            if (!requestingAgent.EqualsGrid(info.Owner))
            {
                return(false);
            }

            bool f = m_Experiences.Remove(id.ID);

            m_Perms.Remove(id);
            m_KeyValues.Remove(id);
            m_Admins.Remove(id);
            return(f);
        }
Esempio n. 25
0
        public void HandleChatDistanceWhisperUpdated(UUID regionid, string value)
        {
            double val;

            if (value?.Length == 0)
            {
                m_WhisperDistances.Remove(regionid);
            }
            else if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out val))
            {
                m_WhisperDistances[regionid] = val;
            }

            /* update regions */
            if (regionid != UUID.Zero)
            {
                SceneInterface scene;
                if (m_Scenes.TryGetValue(regionid, out scene))
                {
                    ChatHandler chat;
                    if (TryGetChatHandler(scene, out chat))
                    {
                        chat.WhisperDistance = GetWhisperDistance(regionid);
                    }
                }
            }
            else
            {
                foreach (SceneInterface scene in m_Scenes.Values)
                {
                    ChatHandler chat;
                    if (TryGetChatHandler(scene, out chat))
                    {
                        chat.WhisperDistance = GetWhisperDistance(regionid);
                    }
                }
            }
        }
Esempio n. 26
0
 public IScriptCompiler this[string name]
 {
     get
     {
         return(string.IsNullOrEmpty(name) ?
                m_ScriptCompilers[DefaultCompilerName] :
                m_ScriptCompilers[name]);
     }
     set
     {
         if (string.IsNullOrEmpty(name))
         {
             throw new ArgumentException("value");
         }
         if (value == null)
         {
             m_ScriptCompilers.Remove(name);
         }
         else
         {
             m_ScriptCompilers.Add(name, value);
         }
     }
 }
Esempio n. 27
0
        public override void Add(IObject obj)
        {
            var objgroup = obj as ObjectGroup;

            if (objgroup != null)
            {
                UGUI uui = objgroup.LastOwner;
                if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                {
                    objgroup.LastOwner = uui;
                }
                foreach (ObjectPart part in objgroup.Values)
                {
                    uui = part.Owner;
                    if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                    {
                        part.Owner = uui;
                    }
                    uui = part.Creator;
                    if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                    {
                        part.Creator = uui;
                    }
                    foreach (ObjectPartInventoryItem item in part.Inventory.ValuesByKey1)
                    {
                        uui = item.Owner;
                        if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                        {
                            item.Owner = uui;
                        }
                        uui = item.LastOwner;
                        if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                        {
                            item.LastOwner = uui;
                        }
                        uui = item.Creator;
                        if (uui.HomeURI == null && AvatarNameService.TryGetValue(uui, out uui))
                        {
                            item.Creator = uui;
                        }
                    }
                    part.RezDate = Date.Now;
                }

                var removeAgain = new List <ObjectPart>();

                AddLegacyMaterials(objgroup);

                try
                {
                    objgroup.Scene = this;
                    foreach (ObjectPart objpart in objgroup.Values)
                    {
                        AddNewLocalID(objpart);
                        m_Primitives.Add(objpart.ID, objpart.LocalID[ID], objpart);
                        removeAgain.Add(objpart);
                    }
                    m_Objects.Add(objgroup.ID, objgroup);

                    foreach (ObjectPart objpart in objgroup.Values)
                    {
                        Interlocked.Increment(ref m_PrimitiveCount);
                        objpart.SendObjectUpdate();
                    }
                    Interlocked.Increment(ref m_ObjectCount);
                }
                catch (Exception e)
                {
                    m_Log.DebugFormat("Failed to add object: {0}: {1}\n{2}", e.GetType().FullName, e.Message, e.StackTrace);
                    m_Objects.Remove(objgroup.ID);
                    foreach (ObjectPart objpart in removeAgain)
                    {
                        m_Primitives.Remove(objpart.ID);
                        RemoveLocalID(objpart);
                    }
                    objgroup.Scene = null;
                }
            }
            else
            {
                AddNewLocalID(obj);
                try
                {
                    m_Objects.Add(obj.ID, obj);
                    if (obj.GetType().GetInterfaces().Contains(typeof(IAgent)))
                    {
                        var agent = (IAgent)obj;
                        m_Agents.Add(obj.ID, agent);
                        Interlocked.Increment(ref m_AgentCount);
                        foreach (IAgentListener aglistener in AgentListeners)
                        {
                            try
                            {
                                aglistener.AddedAgent(agent);
                            }
                            catch (Exception e)
                            {
                                m_Log.DebugFormat("Exception {0}\n{1}", e.Message, e.StackTrace);
                            }
                        }
                    }
                }
                catch
                {
                    if (m_Agents.Remove(obj.ID))
                    {
                        Interlocked.Decrement(ref m_AgentCount);
                    }
                    m_Objects.Remove(obj.ID);
                    RemoveLocalID(obj);
                }
            }
        }
Esempio n. 28
0
 public override void DeleteRegion(UUID regionID)
 {
     m_Data.Remove(regionID);
 }
Esempio n. 29
0
 public override bool Remove(uint estateID)
 {
     return(m_Data.Remove(estateID));
 }
Esempio n. 30
0
 bool IEstateRegionMapServiceInterface.Remove(UUID regionID) =>
 m_RegionMapData.Remove(regionID);