diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 0707119eb8..5d50a83e51 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -180,6 +180,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); sp.Teleport(position); + + foreach (SceneObjectGroup grp in sp.Attachments) + sp.Scene.EventManager.TriggerOnScriptChangedEvent(grp.LocalId, (uint)Changed.TELEPORT); } else // Another region possibly in another simulator { @@ -393,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer agent.Position = position; SetCallbackURL(agent, sp.Scene.RegionInfo); - UpdateAgent(reg, finalDestination, agent); + if (!UpdateAgent(reg, finalDestination, agent)) + { + // Region doesn't take it + Fail(sp, finalDestination); + return; + } m_log.DebugFormat( "[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID); @@ -418,21 +426,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // that the client contacted the destination before we send the attachments and close things here. if (!WaitForCallback(sp.UUID)) { - // Client never contacted destination. Let's restore everything back - sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); - - // Fail. Reset it back - sp.IsChildAgent = false; - - ResetFromTransit(sp.UUID); - - // Yikes! We should just have a ref to scene here. - //sp.Scene.InformClientOfNeighbours(sp); - EnableChildAgents(sp); - - // Finally, kill the agent we just created at the destination. - m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); - + Fail(sp, finalDestination); return; } @@ -472,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } } + private void Fail(ScenePresence sp, GridRegion finalDestination) + { + // Client never contacted destination. Let's restore everything back + sp.ControllingClient.SendTeleportFailed("Problems connecting to destination."); + + // Fail. Reset it back + sp.IsChildAgent = false; + + ResetFromTransit(sp.UUID); + + EnableChildAgents(sp); + + // Finally, kill the agent we just created at the destination. + m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID); + + } protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) { @@ -810,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort + "/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/"; - m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent); + if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent)) + { + // region doesn't take it + ResetFromTransit(agent.UUID); + return agent; + } // Next, let's close the child agent connections that are too far away. agent.CloseChildAgents(neighbourx, neighboury); @@ -1120,7 +1135,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer string reason = String.Empty; - bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, 0, out reason); // m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason); + bool regionAccepted = m_scene.SimulationService.CreateAgent(reg, a, (uint)TeleportFlags.Default, out reason); if (regionAccepted && newAgent) { diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 9594e6bfbf..55060c3e8a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2480,7 +2480,7 @@ namespace OpenSim.Region.Framework.Scenes /// - /// Called when objects or attachments cross the border between regions. + /// Called when objects or attachments cross the border, or teleport, between regions. /// /// /// @@ -2510,6 +2510,8 @@ namespace OpenSim.Region.Framework.Scenes // Do this as late as possible so that listeners have full access to the incoming object EventManager.TriggerOnIncomingSceneObject(newObject); + + TriggerChangedTeleport(newObject); return true; } @@ -2577,22 +2579,13 @@ namespace OpenSim.Region.Framework.Scenes // Fix up attachment Parent Local ID ScenePresence sp = GetScenePresence(sceneObject.OwnerID); - //uint parentLocalID = 0; if (sp != null) { - //parentLocalID = sp.LocalId; - - //sceneObject.RootPart.IsAttachment = true; - //sceneObject.RootPart.SetParentLocalId(parentLocalID); SceneObjectGroup grp = sceneObject; - //RootPrim.SetParentLocalId(parentLocalID); - m_log.DebugFormat( "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); - - //grp.SetFromAssetID(grp.RootPart.LastOwnerID); m_log.DebugFormat( "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); @@ -2602,7 +2595,6 @@ namespace OpenSim.Region.Framework.Scenes AttachmentsModule.AttachObject( sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); - //grp.SendGroupFullUpdate(); } else { @@ -2630,6 +2622,27 @@ namespace OpenSim.Region.Framework.Scenes return true; } + + private void TriggerChangedTeleport(SceneObjectGroup sog) + { + ScenePresence sp = GetScenePresence(sog.OwnerID); + + if (sp != null) + { + AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(sp.UUID); + + if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default)) + { + // This will get your attention + //m_log.Error("[XXX] Triggering "); + + // Trigger CHANGED_TELEPORT + sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT); + } + + } + } + #endregion #region Add/Remove Avatar Methods @@ -3437,6 +3450,8 @@ namespace OpenSim.Region.Framework.Scenes public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason) { TeleportFlags tp = (TeleportFlags)teleportFlags; + reason = String.Empty; + //Teleport flags: // // TeleportFlags.ViaGodlikeLure - Border Crossing @@ -3444,52 +3459,34 @@ namespace OpenSim.Region.Framework.Scenes // TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport - - if (LoginsDisabled) - { - reason = "Logins Disabled"; - return false; - } // Don't disable this log message - it's too helpful m_log.InfoFormat( "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode, teleportFlags); - reason = String.Empty; - try + if (LoginsDisabled) { - if (!VerifyUserPresence(agent, out reason)) - return false; - } - catch (Exception e) - { - m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); + reason = "Logins Disabled"; return false; } - try - { - if (!AuthorizeUser(agent, out reason)) - return false; - } - catch (Exception e) - { - m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); - return false; - } + ScenePresence sp = GetScenePresence(agent.AgentID); - m_log.InfoFormat( - "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", - RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode); - - CapsModule.NewUserConnection(agent); + if (sp != null && !sp.IsChildAgent) + { + // We have a zombie from a crashed session. + // Or the same user is trying to be root twice here, won't work. + // Kill it. + m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); + sp.ControllingClient.Close(); + sp = null; + } ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); - //On login or border crossing test land permisions - if (tp != TeleportFlags.Default) + //On login test land permisions + if (tp == TeleportFlags.ViaLogin) { if (land != null && !TestLandRestrictions(agent, land, out reason)) { @@ -3497,8 +3494,40 @@ namespace OpenSim.Region.Framework.Scenes } } - ScenePresence sp = GetScenePresence(agent.AgentID); - if (sp != null) + if (sp == null) // We don't have an [child] agent here already + { + + try + { + if (!VerifyUserPresence(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.DebugFormat("[CONNECTION BEGIN]: Exception verifying presence {0}", e.Message); + return false; + } + + try + { + if (!AuthorizeUser(agent, out reason)) + return false; + } + catch (Exception e) + { + m_log.DebugFormat("[CONNECTION BEGIN]: Exception authorizing user {0}", e.Message); + return false; + } + + m_log.InfoFormat( + "[CONNECTION BEGIN]: Region {0} authenticated and authorized incoming {1} agent {2} {3} {4} (circuit code {5})", + RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, + agent.AgentID, agent.circuitcode); + + CapsModule.NewUserConnection(agent); + CapsModule.AddCapsHandler(agent.AgentID); + } + else { if (sp.IsChildAgent) { @@ -3507,22 +3536,18 @@ namespace OpenSim.Region.Framework.Scenes agent.AgentID, RegionInfo.RegionName); sp.AdjustKnownSeeds(); - - return true; - } - else - { - // We have a zombie from a crashed session. Kill it. - m_log.DebugFormat("[SCENE]: Zombie scene presence detected for {0} in {1}", agent.AgentID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + CapsModule.NewUserConnection(agent); } } - CapsModule.AddCapsHandler(agent.AgentID); - if (!agent.child) + // In all cases, add or update the circuit data with the new agent circuit data and teleport flags + agent.teleportFlags = teleportFlags; + m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); + + if (tp == TeleportFlags.ViaLogin) { - if (TestBorderCross(agent.startpos,Cardinals.E)) + if (TestBorderCross(agent.startpos, Cardinals.E)) { Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); agent.startpos.X = crossedBorder.BorderLine.Z - 1; @@ -3587,9 +3612,6 @@ namespace OpenSim.Region.Framework.Scenes } } - agent.teleportFlags = teleportFlags; - m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); - return true; } @@ -3881,6 +3903,8 @@ namespace OpenSim.Region.Framework.Scenes m_log.DebugFormat( "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); + // XPTO: if this agent is not allowed here as root, always return false + // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 8b83b0660c..866bb6e70e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -555,7 +555,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (TaskInventoryItem item in items) { m_items.Add(item.ItemID, item); - m_part.TriggerScriptChangedEvent(Changed.INVENTORY); +// m_part.TriggerScriptChangedEvent(Changed.INVENTORY); } } diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index f7544ac2ee..5bdaa17f69 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -221,7 +221,16 @@ namespace OpenSim.Region.Framework.Scenes.Serialization sr = new StringReader(parts[i].OuterXml); reader = new XmlTextReader(sr); SceneObjectPart part = SceneObjectPart.FromXml(reader); + + int originalLinkNum = part.LinkNum; + sceneObject.AddPart(part); + + // SceneObjectGroup.AddPart() tries to be smart and automatically set the LinkNum. + // We override that here + if (originalLinkNum != 0) + part.LinkNum = originalLinkNum; + part.StoreUndoState(); reader.Close(); sr.Close(); diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 7984bd9b00..a9e9f5cd1b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -1771,7 +1771,18 @@ namespace OpenSim.Region.Physics.OdePlugin IMesh mesh = null; if (needsMeshing(pbs)) - mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); + { + try + { + mesh = mesher.CreateMesh(primName, pbs, size, 32f, isPhysical); + } + catch(Exception e) + { + m_log.ErrorFormat("[PHYSICS]: Exception while meshing prim {0}."); + m_log.Debug(e.ToString()); + mesh = null; + } + } result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5400a4f42f..59ab26bee5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2699,6 +2699,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // objects rezzed with this method are die_at_edge by default. new_group.RootPart.SetDieAtEdge(true); + new_group.ResumeScripts(); + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( "object_rez", new Object[] { new LSL_String( diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index b14206a066..0bc3d87833 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -126,7 +126,7 @@ ; -->>> There are multiple connection strings defined in several places. Check it carefully! ; ; storage_plugin="OpenSim.Data.MySQL.dll" - ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; + ; storage_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"; ; If you want to use a different database/server for estate data, then ; uncomment and change this connect string. Defaults to the above if not set ; estate_connection_string="Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;"; diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 9af1e4cdf3..2d69382b10 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -28,7 +28,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [DatabaseService] StorageProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" + ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" ; * As an example, the below configuration precisely mimicks the legacy ; * asset server. It is read by the asset IN connector (defined above) diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index f1b91269a7..8331db85b1 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -28,7 +28,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 [DatabaseService] StorageProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=opensim123;" + ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" ; * As an example, the below configuration precisely mimicks the legacy diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example index 572c153bef..bfa67259ab 100644 --- a/bin/config-include/StandaloneCommon.ini.example +++ b/bin/config-include/StandaloneCommon.ini.example @@ -17,7 +17,7 @@ ; Uncomment these lines if you want to use mysql storage ; Change the connection string to your db details ;StorageProvider = "OpenSim.Data.MySQL.dll" - ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;" + ;ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=***;Old Guids=true;" [AssetService] DefaultAssetLoader = "OpenSim.Framework.AssetLoader.Filesystem.dll"