From 016a648a3097b452f63b82af533e92c549ce0ca6 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Fri, 4 Sep 2009 20:19:34 -0400 Subject: * Fixes various quirks rezzing in virtual regions. * Breaks up the Client event registrations in Scene into methods of similar event types. The generic event registration registers all of the event types. *Created symmetrical Un-Registration methods. * Made the Registration and Unregistration methods public * Hooks The events required for creating new prim and rezzing new prim into the proper scene. --- OpenSim/Region/Framework/Scenes/Scene.cs | 268 +++++++++++++++++++++++++++---- 1 file changed, 241 insertions(+), 27 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1d0da4c..c25ae10 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2365,14 +2365,40 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerOnNewClient(client); } + + /// /// Register for events from the client /// /// The IClientAPI of the connected client - protected virtual void SubscribeToClientEvents(IClientAPI client) + public virtual void SubscribeToClientEvents(IClientAPI client) + { + SubscribeToClientTerrainEvents(client); + SubscribeToClientPrimEvents(client); + SubscribeToClientPrimRezEvents(client); + SubscribeToClientInventoryEvents(client); + SubscribeToClientAttachmentEvents(client); + SubscribeToClientTeleportEvents(client); + SubscribeToClientScriptEvents(client); + SubscribeToClientParcelEvents(client); + SubscribeToClientGridEvents(client); + SubscribeToClientGodEvents(client); + + SubscribeToClientNetworkEvents(client); + + + // EventManager.TriggerOnNewClient(client); + } + + public virtual void SubscribeToClientTerrainEvents(IClientAPI client) { client.OnRegionHandShakeReply += SendLayerData; - client.OnAddPrim += AddNewPrim; + client.OnUnackedTerrain += TerrainUnAcked; + } + + public virtual void SubscribeToClientPrimEvents(IClientAPI client) + { + client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; @@ -2384,8 +2410,6 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdateExtraParams += m_sceneGraph.UpdateExtraParam; client.OnUpdatePrimShape += m_sceneGraph.UpdatePrimShape; client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; - client.OnTeleportLocationRequest += RequestTeleportLocation; - client.OnTeleportLandmarkRequest += RequestTeleportLandmark; client.OnObjectRequest += RequestPrim; client.OnObjectSelect += SelectPrim; client.OnObjectDeselect += DeselectPrim; @@ -2393,15 +2417,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnSpinStart += m_sceneGraph.SpinStart; client.OnSpinUpdate += m_sceneGraph.SpinObject; client.OnDeRezObject += DeRezObject; - client.OnRezObject += RezObject; - client.OnRezSingleAttachmentFromInv += RezSingleAttachment; - client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; - client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; - client.OnObjectAttach += m_sceneGraph.AttachObject; - client.OnObjectDetach += m_sceneGraph.DetachObject; - client.OnObjectDrop += m_sceneGraph.DropObject; - client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; - client.OnObjectDescription += m_sceneGraph.PrimDescription; + client.OnObjectName += m_sceneGraph.PrimName; client.OnObjectClickAction += m_sceneGraph.PrimClickAction; client.OnObjectMaterial += m_sceneGraph.PrimMaterial; @@ -2412,7 +2428,24 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; + client.OnGrabObject += ProcessObjectGrab; + client.OnDeGrabObject += ProcessObjectDeGrab; + client.OnUndo += m_sceneGraph.HandleUndo; + client.OnObjectDescription += m_sceneGraph.PrimDescription; + client.OnObjectDrop += m_sceneGraph.DropObject; + client.OnObjectSaleInfo += ObjectSaleInfo; + client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; + client.OnObjectOwner += ObjectOwner; + } + + public virtual void SubscribeToClientPrimRezEvents(IClientAPI client) + { + client.OnAddPrim += AddNewPrim; + client.OnRezObject += RezObject; + } + public virtual void SubscribeToClientInventoryEvents(IClientAPI client) + { client.OnCreateNewInventoryItem += CreateNewInventoryItem; client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; @@ -2430,36 +2463,217 @@ namespace OpenSim.Region.Framework.Scenes client.OnRemoveTaskItem += RemoveTaskInventory; client.OnUpdateTaskInventory += UpdateTaskInventory; client.OnMoveTaskItem += ClientMoveTaskInventoryItem; + } - client.OnGrabObject += ProcessObjectGrab; - client.OnDeGrabObject += ProcessObjectDeGrab; - client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; - client.OnParcelBuy += ProcessParcelBuy; - client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; - client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; + public virtual void SubscribeToClientAttachmentEvents(IClientAPI client) + { + client.OnRezSingleAttachmentFromInv += RezSingleAttachment; + client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachments; + client.OnDetachAttachmentIntoInv += DetachSingleAttachmentToInv; + client.OnObjectAttach += m_sceneGraph.AttachObject; + client.OnObjectDetach += m_sceneGraph.DetachObject; + } + + public virtual void SubscribeToClientTeleportEvents(IClientAPI client) + { + client.OnTeleportLocationRequest += RequestTeleportLocation; + client.OnTeleportLandmarkRequest += RequestTeleportLandmark; client.OnTeleportHomeRequest += TeleportClientHome; - client.OnSetStartLocationRequest += SetHomeRezPoint; - client.OnUndo += m_sceneGraph.HandleUndo; - client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; - client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; - client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; - client.OnObjectSaleInfo += ObjectSaleInfo; + } + + public virtual void SubscribeToClientScriptEvents(IClientAPI client) + { client.OnScriptReset += ProcessScriptReset; client.OnGetScriptRunning += GetScriptRunning; client.OnSetScriptRunning += SetScriptRunning; + } + + public virtual void SubscribeToClientParcelEvents(IClientAPI client) + { + client.OnObjectGroupRequest += m_sceneGraph.HandleObjectGroupUpdate; + client.OnParcelReturnObjectsRequest += LandChannel.ReturnObjectsInParcel; + client.OnParcelSetOtherCleanTime += LandChannel.SetParcelOtherCleanTime; + client.OnParcelBuy += ProcessParcelBuy; + } + + public virtual void SubscribeToClientGridEvents(IClientAPI client) + { + client.OnNameFromUUIDRequest += CommsManager.HandleUUIDNameRequest; + client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; + client.OnAvatarPickerRequest += ProcessAvatarPickerRequest; + client.OnSetStartLocationRequest += SetHomeRezPoint; client.OnRegionHandleRequest += RegionHandleRequest; - client.OnUnackedTerrain += TerrainUnAcked; - client.OnObjectOwner += ObjectOwner; + } + public virtual void SubscribeToClientGodEvents(IClientAPI client) + { IGodsModule godsModule = RequestModuleInterface(); client.OnGodKickUser += godsModule.KickUser; client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; + } + public virtual void SubscribeToClientNetworkEvents(IClientAPI client) + { client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; + } + + protected virtual void UnsubscribeToClientEvents(IClientAPI client) + { + + } + + /// + /// Register for events from the client + /// + /// The IClientAPI of the connected client + public virtual void UnSubscribeToClientEvents(IClientAPI client) + { + UnSubscribeToClientTerrainEvents(client); + UnSubscribeToClientPrimEvents(client); + UnSubscribeToClientPrimRezEvents(client); + UnSubscribeToClientInventoryEvents(client); + UnSubscribeToClientAttachmentEvents(client); + UnSubscribeToClientTeleportEvents(client); + UnSubscribeToClientScriptEvents(client); + UnSubscribeToClientParcelEvents(client); + UnSubscribeToClientGridEvents(client); + UnSubscribeToClientGodEvents(client); + + UnSubscribeToClientNetworkEvents(client); + // EventManager.TriggerOnNewClient(client); } + public virtual void UnSubscribeToClientTerrainEvents(IClientAPI client) + { + client.OnRegionHandShakeReply -= SendLayerData; + client.OnUnackedTerrain -= TerrainUnAcked; + } + + public virtual void UnSubscribeToClientPrimEvents(IClientAPI client) + { + client.OnUpdatePrimGroupPosition -= m_sceneGraph.UpdatePrimPosition; + client.OnUpdatePrimSinglePosition -= m_sceneGraph.UpdatePrimSinglePosition; + client.OnUpdatePrimGroupRotation -= m_sceneGraph.UpdatePrimRotation; + client.OnUpdatePrimGroupMouseRotation -= m_sceneGraph.UpdatePrimRotation; + client.OnUpdatePrimSingleRotation -= m_sceneGraph.UpdatePrimSingleRotation; + client.OnUpdatePrimSingleRotationPosition -= m_sceneGraph.UpdatePrimSingleRotationPosition; + client.OnUpdatePrimScale -= m_sceneGraph.UpdatePrimScale; + client.OnUpdatePrimGroupScale -= m_sceneGraph.UpdatePrimGroupScale; + client.OnUpdateExtraParams -= m_sceneGraph.UpdateExtraParam; + client.OnUpdatePrimShape -= m_sceneGraph.UpdatePrimShape; + client.OnUpdatePrimTexture -= m_sceneGraph.UpdatePrimTexture; + client.OnObjectRequest -= RequestPrim; + client.OnObjectSelect -= SelectPrim; + client.OnObjectDeselect -= DeselectPrim; + client.OnGrabUpdate -= m_sceneGraph.MoveObject; + client.OnSpinStart -= m_sceneGraph.SpinStart; + client.OnSpinUpdate -= m_sceneGraph.SpinObject; + client.OnDeRezObject -= DeRezObject; + client.OnObjectName -= m_sceneGraph.PrimName; + client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; + client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; + client.OnLinkObjects -= m_sceneGraph.LinkObjects; + client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; + client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; + client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; + client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; + client.OnRequestObjectPropertiesFamily -= m_sceneGraph.RequestObjectPropertiesFamily; + client.OnObjectPermissions -= HandleObjectPermissionsUpdate; + client.OnGrabObject -= ProcessObjectGrab; + client.OnDeGrabObject -= ProcessObjectDeGrab; + client.OnUndo -= m_sceneGraph.HandleUndo; + client.OnObjectDescription -= m_sceneGraph.PrimDescription; + client.OnObjectDrop -= m_sceneGraph.DropObject; + client.OnObjectSaleInfo -= ObjectSaleInfo; + client.OnObjectIncludeInSearch -= m_sceneGraph.MakeObjectSearchable; + client.OnObjectOwner -= ObjectOwner; + } + + public virtual void UnSubscribeToClientPrimRezEvents(IClientAPI client) + { + client.OnAddPrim -= AddNewPrim; + client.OnRezObject -= RezObject; + } + + + public virtual void UnSubscribeToClientInventoryEvents(IClientAPI client) + { + client.OnCreateNewInventoryItem -= CreateNewInventoryItem; + client.OnCreateNewInventoryFolder -= HandleCreateInventoryFolder; + client.OnUpdateInventoryFolder -= HandleUpdateInventoryFolder; + client.OnMoveInventoryFolder -= HandleMoveInventoryFolder; // 2; //!! + client.OnFetchInventoryDescendents -= HandleFetchInventoryDescendents; + client.OnPurgeInventoryDescendents -= HandlePurgeInventoryDescendents; // 2; //!! + client.OnFetchInventory -= HandleFetchInventory; + client.OnUpdateInventoryItem -= UpdateInventoryItemAsset; + client.OnCopyInventoryItem -= CopyInventoryItem; + client.OnMoveInventoryItem -= MoveInventoryItem; + client.OnRemoveInventoryItem -= RemoveInventoryItem; + client.OnRemoveInventoryFolder -= RemoveInventoryFolder; + client.OnRezScript -= RezScript; + client.OnRequestTaskInventory -= RequestTaskInventory; + client.OnRemoveTaskItem -= RemoveTaskInventory; + client.OnUpdateTaskInventory -= UpdateTaskInventory; + client.OnMoveTaskItem -= ClientMoveTaskInventoryItem; + } + + public virtual void UnSubscribeToClientAttachmentEvents(IClientAPI client) + { + client.OnRezSingleAttachmentFromInv -= RezSingleAttachment; + client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachments; + client.OnDetachAttachmentIntoInv -= DetachSingleAttachmentToInv; + client.OnObjectAttach -= m_sceneGraph.AttachObject; + client.OnObjectDetach -= m_sceneGraph.DetachObject; + } + + public virtual void UnSubscribeToClientTeleportEvents(IClientAPI client) + { + client.OnTeleportLocationRequest -= RequestTeleportLocation; + client.OnTeleportLandmarkRequest -= RequestTeleportLandmark; + client.OnTeleportHomeRequest -= TeleportClientHome; + } + + public virtual void UnSubscribeToClientScriptEvents(IClientAPI client) + { + client.OnScriptReset -= ProcessScriptReset; + client.OnGetScriptRunning -= GetScriptRunning; + client.OnSetScriptRunning -= SetScriptRunning; + } + + public virtual void UnSubscribeToClientParcelEvents(IClientAPI client) + { + client.OnObjectGroupRequest -= m_sceneGraph.HandleObjectGroupUpdate; + client.OnParcelReturnObjectsRequest -= LandChannel.ReturnObjectsInParcel; + client.OnParcelSetOtherCleanTime -= LandChannel.SetParcelOtherCleanTime; + client.OnParcelBuy -= ProcessParcelBuy; + } + + public virtual void UnSubscribeToClientGridEvents(IClientAPI client) + { + client.OnNameFromUUIDRequest -= CommsManager.HandleUUIDNameRequest; + client.OnMoneyTransferRequest -= ProcessMoneyTransferRequest; + client.OnAvatarPickerRequest -= ProcessAvatarPickerRequest; + client.OnSetStartLocationRequest -= SetHomeRezPoint; + client.OnRegionHandleRequest -= RegionHandleRequest; + } + + public virtual void UnSubscribeToClientGodEvents(IClientAPI client) + { + IGodsModule godsModule = RequestModuleInterface(); + client.OnGodKickUser -= godsModule.KickUser; + client.OnRequestGodlikePowers -= godsModule.RequestGodlikePowers; + } + + public virtual void UnSubscribeToClientNetworkEvents(IClientAPI client) + { + client.OnNetworkStatsUpdate -= StatsReporter.AddPacketsStats; + } + + + + /// /// Teleport an avatar to their home region /// -- cgit v1.1 From c48ec978179ade68cf816e3134e11ddde71f8bfc Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 4 Sep 2009 22:30:30 -0700 Subject: Fixed some long-standing issues with appearance in HG1. --- .../Scenes/Hypergrid/HGScene.Inventory.cs | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index dd6928f..8fe3565 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs @@ -113,26 +113,26 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { - //m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); - - if (fromTaskID.Equals(UUID.Zero)) + m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); + + //if (fromTaskID.Equals(UUID.Zero)) + //{ + InventoryItemBase item = new InventoryItemBase(itemID); + item.Owner = remoteClient.AgentId; + item = InventoryService.GetItem(item); + //if (item == null) + //{ // Fetch the item + // item = new InventoryItemBase(); + // item.Owner = remoteClient.AgentId; + // item.ID = itemID; + // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); + //} + if (item != null) { - InventoryItemBase item = new InventoryItemBase(itemID); - item.Owner = remoteClient.AgentId; - item = InventoryService.GetItem(item); - //if (item == null) - //{ // Fetch the item - // item = new InventoryItemBase(); - // item.Owner = remoteClient.AgentId; - // item.ID = itemID; - // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); - //} - if (item != null) - { - m_assMapper.Get(item.AssetID, remoteClient.AgentId); - - } + m_assMapper.Get(item.AssetID, remoteClient.AgentId); + } + //} // OK, we're done fetching. Pass it up to the default RezObject return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection, -- cgit v1.1 From 855fb58c9650086122b76c586c4a4a408343143f Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sat, 5 Sep 2009 02:58:35 -0400 Subject: * Moves ScenePresence SendCourseLocations to a delegate and provide a method to replace the delegate * RegionCombinerModule replaces this delegate and distributes the CoarseLocationUpdates through the client connection in the region where the user would be if it was a separate region. * Fixes Mini Map display on combined regions. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 857dc11..1024857 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes public ScriptControlled eventControls; } + public delegate void SendCourseLocationsMethod(UUID scene, ScenePresence presence); + public class ScenePresence : EntityBase { // ~ScenePresence() @@ -87,12 +89,15 @@ namespace OpenSim.Region.Framework.Scenes public Vector3 lastKnownAllowedPosition; public bool sentMessageAboutRestrictedParcelFlyingDown; + + private bool m_updateflag; private byte m_movementflag; private readonly List m_forcesList = new List(); private short m_updateCount; private uint m_requestedSitTargetID; private UUID m_requestedSitTargetUUID = UUID.Zero; + private SendCourseLocationsMethod m_sendCourseLocationsMethod; private bool m_startAnimationSet; @@ -616,6 +621,7 @@ namespace OpenSim.Region.Framework.Scenes private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) { + m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); m_regionHandle = reginfo.RegionHandle; m_controllingClient = client; @@ -2458,6 +2464,21 @@ namespace OpenSim.Region.Framework.Scenes public void SendCoarseLocations() { + SendCourseLocationsMethod d = m_sendCourseLocationsMethod; + if (d != null) + { + d.Invoke(m_scene.RegionInfo.originRegionID, this); + } + } + + public void SetSendCourseLocationMethod(SendCourseLocationsMethod d) + { + if (d != null) + m_sendCourseLocationsMethod = d; + } + + public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) + { m_perfMonMS = Environment.TickCount; List CoarseLocations = new List(); @@ -3302,6 +3323,7 @@ namespace OpenSim.Region.Framework.Scenes { Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); DefaultTexture = textu.GetBytes(); + } public class NewForce @@ -3431,6 +3453,7 @@ namespace OpenSim.Region.Framework.Scenes Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); DefaultTexture = textu.GetBytes(); } + m_sendCourseLocationsMethod = SendCoarseLocationsDefault; CreateSceneViewer(); } -- cgit v1.1 From dcebbc3f1b27cf01ae28cb522c5180c195729823 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 15:55:14 +0100 Subject: Remove the encryption from the IAuthenticationService interface. That is too high up for that type of stuff. It needs to be at the connector/handler level --- OpenSim/Region/Framework/Scenes/Scene.cs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c25ae10..8cd77f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes private bool m_scripts_enabled = true; private string m_defaultScriptEngine; private int m_LastLogin = 0; - private Thread HeartbeatThread; + private Thread HeartbeatThread = null; private volatile bool shuttingdown = false; private int m_lastUpdate = Environment.TickCount; @@ -876,6 +876,13 @@ namespace OpenSim.Region.Framework.Scenes //m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); + if (HeartbeatThread != null) + { + ThreadTracker.Remove(HeartbeatThread); + HeartbeatThread.Abort(); + HeartbeatThread = null; + } + m_lastUpdate = Environment.TickCount; HeartbeatThread = new Thread(new ParameterizedThreadStart(Heartbeat)); HeartbeatThread.SetApartmentState(ApartmentState.MTA); HeartbeatThread.Name = string.Format("Heartbeat for region {0}", RegionInfo.RegionName); @@ -912,9 +919,15 @@ namespace OpenSim.Region.Framework.Scenes /// private void Heartbeat(object sender) { - Update(); + try + { + Update(); - m_lastUpdate = Environment.TickCount; + m_lastUpdate = Environment.TickCount; + } + catch (ThreadAbortException) + { + } } /// @@ -2307,6 +2320,7 @@ namespace OpenSim.Region.Framework.Scenes /// public override void AddNewClient(IClientAPI client) { + CheckHeartbeat(); SubscribeToClientEvents(client); ScenePresence presence; @@ -2831,6 +2845,7 @@ namespace OpenSim.Region.Framework.Scenes /// protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client) { + CheckHeartbeat(); AvatarAppearance appearance = null; GetAvatarAppearance(client, out appearance); @@ -2873,6 +2888,7 @@ namespace OpenSim.Region.Framework.Scenes /// public override void RemoveClient(UUID agentID) { + CheckHeartbeat(); bool childagentYN = false; ScenePresence avatar = GetScenePresence(agentID); if (avatar != null) @@ -4374,6 +4390,8 @@ namespace OpenSim.Region.Framework.Scenes else return health; + CheckHeartbeat(); + return health; } @@ -4559,5 +4577,11 @@ namespace OpenSim.Region.Framework.Scenes return (((vsn.X * xdiff) + (vsn.Y * ydiff)) / (-1 * vsn.Z)) + p0.Z; } + + private void CheckHeartbeat() + { + if (System.Environment.TickCount - m_lastUpdate > 2000) + StartTimer(); + } } } -- cgit v1.1 From 998624544c5120676e3048990ef74956210be959 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 6 Sep 2009 16:14:45 +0100 Subject: Addendum to last commit. With the last commit, some other code that should have been in this commit slipped in. If the last heartbeat is more than 2 seconds ago, kill that thread and start a new one. Untested. his commit adds support to let the first heartbeat complete unconditionally, since it is almost always longer. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8cd77f8..8f3ba97 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -225,6 +225,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_lastUpdate = Environment.TickCount; private int m_maxPrimsPerFrame = 200; + private bool m_firstHeartbeat = true; private object m_deleting_scene_object = new object(); @@ -924,6 +925,7 @@ namespace OpenSim.Region.Framework.Scenes Update(); m_lastUpdate = Environment.TickCount; + m_firstHeartbeat = false; } catch (ThreadAbortException) { @@ -4580,6 +4582,9 @@ namespace OpenSim.Region.Framework.Scenes private void CheckHeartbeat() { + if (m_firstHeartbeat) + return; + if (System.Environment.TickCount - m_lastUpdate > 2000) StartTimer(); } -- cgit v1.1 From 511bddc8bc5783919a8135b69ddd6c974fbcf1f7 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 6 Sep 2009 16:15:06 -0400 Subject: * Moves another Legacy avatar inbounds check to Border --- OpenSim/Region/Framework/Scenes/Scene.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c25ae10..278091f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3140,11 +3140,17 @@ namespace OpenSim.Region.Framework.Scenes if (!agent.child) { - if (agent.startpos.X > (int)Constants.RegionSize - 1) - agent.startpos.X = (int)Constants.RegionSize - 1; + if (TestBorderCross(agent.startpos,Cardinals.E)) + { + Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); + agent.startpos.X = crossedBorder.BorderLine.Z - 1; + } - if (agent.startpos.Y > (int)Constants.RegionSize - 1) - agent.startpos.Y = (int)Constants.RegionSize - 1; + if (TestBorderCross(agent.startpos, Cardinals.N)) + { + Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.N); + agent.startpos.Y = crossedBorder.BorderLine.Z - 1; + } // Honor parcel landing type and position. ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); -- cgit v1.1 From c4edefd9a0982e5b9c205a39c858d50abc677240 Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Sun, 6 Sep 2009 21:26:59 -0400 Subject: minor: organizational * Move the neighbor region lookup to another method from where it was before in EnableNeighbourChildAgents. --- .../Framework/Scenes/SceneCommunicationService.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c6b3f30..08563d0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -407,6 +407,24 @@ namespace OpenSim.Region.Framework.Scenes //blah.Port = region.RemotingPort; } + public List RequestNeighbors(Scene pScene, uint pRegionLocX, uint pRegionLocY) + { + Border[] northBorders = pScene.NorthBorders.ToArray(); + Border[] southBorders = pScene.SouthBorders.ToArray(); + Border[] eastBorders = pScene.EastBorders.ToArray(); + Border[] westBorders = pScene.WestBorders.ToArray(); + + // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. + if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) + { + return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); + } + else + { + return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); + } + } + /// /// This informs all neighboring regions about agent "avatar". /// Calls an asynchronous method to do so.. so it doesn't lag the sim. @@ -429,7 +447,7 @@ namespace OpenSim.Region.Framework.Scenes if (m_regionInfo != null) { neighbours = - m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); + RequestNeighbors(avatar.Scene,m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); } else { -- cgit v1.1 From 326c3ee14fb294796ff3b908f17da1021d321e3b Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Mon, 7 Sep 2009 12:57:30 -0400 Subject: * Enables Child Agents for all virtual regions in the region and their neighbors. There still may be issues with crossing into the mentioned neighbors of the virtual regions. This makes regions larger then 512x512 (3 virtual regions) display fully to clients. * Uses a grid request multiple times, so the more regions are in the instance, the longer logging in takes. Consider this temporary until there's a RegionInfo request similar to the MapItem Request. --- .../Framework/Scenes/SceneCommunicationService.cs | 58 +++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes') diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 08563d0..0827672 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -367,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes string reason = String.Empty; //bool regionAccepted = m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, a); + bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason); if (regionAccepted && newAgent) @@ -384,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes eq.EnableSimulator(reg.RegionHandle, endPoint, avatar.UUID); eq.EstablishAgentCommunication(avatar.UUID, endPoint, capsPath); - m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", + m_log.DebugFormat("[CAPS]: Sending new CAPS seed url {0} to client {1} in region {2}", capsPath, avatar.UUID, avatar.Scene.RegionInfo.RegionName); } else @@ -394,7 +395,9 @@ namespace OpenSim.Region.Framework.Scenes } m_log.Info("[INTERGRID]: Completed inform client about neighbour " + endPoint.ToString()); + } + } public void RequestNeighbors(RegionInfo region) @@ -421,7 +424,48 @@ namespace OpenSim.Region.Framework.Scenes } else { - return m_commsProvider.GridService.RequestNeighbours(pRegionLocX, pRegionLocY); + Vector2 extent = Vector2.Zero; + for (int i=0;i extent.X) ? eastBorders[i].BorderLine.Z : extent.X; + } + for (int i=0;i extent.Y) ? northBorders[i].BorderLine.Z : extent.Y; + } + + List neighbourList = new List(); + + // Loss of fraction on purpose + extent.X = ((int)extent.X / (int)Constants.RegionSize) + 1; + extent.Y = ((int)extent.Y / (int)Constants.RegionSize) + 1; + + int startX = (int) pRegionLocX - 1; + int startY = (int) pRegionLocY - 1; + + int endX = (int) pRegionLocX + (int)extent.X + 1; + int endY = (int) pRegionLocY + (int)extent.Y + 1; + + for (int i=startX;i