Merge branch 'master' into bigmerge

Conflicts:
	OpenSim/Region/Framework/Scenes/ScenePresence.cs
	OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
avinationmerge
Melanie 2011-11-11 23:43:18 +00:00
commit a4ec97cfdd
6 changed files with 398 additions and 277 deletions

View File

@ -12,7 +12,7 @@ Steps:
=== Building on Linux ===
Prereqs:
* Mono >= 2.4.2
* Mono >= 2.4.3
* Nant >= 0.85
* On some Linux distributions you may need to install additional packages.
See http://opensimulator.org/wiki/Dependencies for more information.
@ -28,5 +28,3 @@ From the distribution type:
Helpful resources:
* http://opensimulator.org/wiki/Build_Instructions

View File

@ -121,7 +121,7 @@ namespace OpenSim
Util.FireAndForgetMethod = asyncCallMethod;
stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
m_consolePrompt = startupConfig.GetString("console_prompt", @"Region (\R) ");
m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
}
if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)

View File

@ -1553,41 +1553,35 @@ namespace OpenSim.Region.ClientStack.LindenUDP
kill.Header.Reliable = true;
kill.Header.Zerocoded = true;
lock (m_killRecord)
{
if (localIDs.Count == 1)
{
if (m_scene.GetScenePresence(localIDs[0]) != null)
if (localIDs.Count == 1 && m_scene.GetScenePresence(localIDs[0]) != null)
{
OutPacket(kill, ThrottleOutPacketType.State);
return;
}
m_killRecord.Add(localIDs[0]);
}
else
{
lock (m_entityUpdates.SyncRoot)
// We MUST lock for both manipulating the kill record and sending the packet, in order to avoid a race
// condition where a kill can be processed before an out-of-date update for the same object.
// ProcessEntityUpdates() also takes the m_killRecord lock.
lock (m_killRecord)
{
foreach (uint localID in localIDs)
m_killRecord.Add(localID);
}
}
}
// The throttle queue used here must match that being used for
// updates. Otherwise, there is a chance that a kill packet put
// on a separate queue will be sent to the client before an
// existing update packet on another queue. Receiving updates
// after kills results in unowned and undeletable
// The throttle queue used here must match that being used for updates. Otherwise, there is a
// chance that a kill packet put on a separate queue will be sent to the client before an existing
// update packet on another queue. Receiving updates after kills results in unowned and undeletable
// scene objects in a viewer until that viewer is relogged in.
OutPacket(kill, ThrottleOutPacketType.Task);
}
}
}
/// <summary>
/// Send information about the items contained in a folder to the client.
///
/// XXX This method needs some refactoring loving
/// </summary>
/// <remarks>
/// XXX This method needs some refactoring loving
/// </remarks>
/// <param name="ownerID">The owner of the folder</param>
/// <param name="folderID">The id of the folder</param>
/// <param name="items">The items contained in the folder identified by folderID</param>

View File

@ -164,7 +164,11 @@ namespace OpenSim.Region.Framework.Scenes
private uint m_requestedSitTargetID;
private UUID m_requestedSitTargetUUID;
public bool SitGround = false;
/// <summary>
/// Are we sitting on the ground?
/// </summary>
public bool SitGround { get; private set; }
private SendCourseLocationsMethod m_sendCourseLocationsMethod;
@ -189,20 +193,12 @@ namespace OpenSim.Region.Framework.Scenes
private readonly Vector3[] Dir_Vectors = new Vector3[11];
protected Timer m_reprioritization_timer;
protected bool m_reprioritizing;
protected bool m_reprioritization_called;
private Quaternion m_headrotation = Quaternion.Identity;
//Reuse the Vector3 instead of creating a new one on the UpdateMovement method
// private Vector3 movementvector;
private bool m_autopilotMoving;
private Vector3 m_autoPilotTarget;
private bool m_sitAtAutoTarget;
private string m_nextSitAnimation = String.Empty;
//PauPaw:Proper PID Controler for autopilot************
@ -1422,20 +1418,8 @@ namespace OpenSim.Region.Framework.Scenes
}
}
if (m_autopilotMoving)
CheckAtSitTarget();
if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) != 0)
{
m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
// TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
//Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
SitGround = true;
}
HandleAgentSitOnGround();
// In the future, these values might need to go global.
// Here's where you get them.
@ -1641,9 +1625,8 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
if (!m_autopilotMoving)
{
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
@ -1747,7 +1730,6 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("Crash! {0}", e.ToString());
}
}
}
return updated;
}
@ -1847,58 +1829,20 @@ namespace OpenSim.Region.Framework.Scenes
AgentControlFlags = (uint)AgentManager.ControlFlags.NONE;
}
private void CheckAtSitTarget()
{
//m_log.Debug("[AUTOPILOT]: " + Util.GetDistanceTo(AbsolutePosition, m_autoPilotTarget).ToString());
if (Util.GetDistanceTo(AbsolutePosition, m_autoPilotTarget) <= 1.5)
{
if (m_sitAtAutoTarget)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetUUID);
if (part != null)
{
AbsolutePosition = part.AbsolutePosition;
Velocity = Vector3.Zero;
SendAvatarDataToAllAgents();
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
}
//ControllingClient.SendSitResponse(m_requestedSitTargetID, m_requestedSitOffset, Quaternion.Identity, false, Vector3.Zero, Vector3.Zero, false);
m_requestedSitTargetUUID = UUID.Zero;
}
/*
else
{
//ControllingClient.SendAlertMessage("Autopilot cancelled");
//SendTerseUpdateToAllClients();
//PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
//proxy.PCode = (byte)PCode.ParticleSystem;
////uint nextUUID = m_scene.NextLocalId;
//proxyObjectGroup = new SceneObjectGroup(m_scene, m_scene.RegionInfo.RegionHandle, UUID, nextUUID, m_autoPilotTarget, Quaternion.Identity, proxy);
//if (proxyObjectGroup != null)
//{
//proxyObjectGroup.SendGroupFullUpdate();
//ControllingClient.SendSitResponse(UUID.Zero, m_autoPilotTarget, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
//m_scene.DeleteSceneObject(proxyObjectGroup);
//}
}
*/
m_autoPilotTarget = Vector3.Zero;
m_autopilotMoving = false;
}
}
/// <summary>
/// Perform the logic necessary to stand the avatar up. This method also executes
/// the stand animation.
/// </summary>
public void StandUp()
{
// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
SitGround = false;
if (PhysicsActor == null)
AddToPhysicalScene(false);
if (ParentID != 0)
{
m_log.Debug("StandupCode Executed");
SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
if (part != null)
{
@ -1926,11 +1870,6 @@ namespace OpenSim.Region.Framework.Scenes
ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
}
if (PhysicsActor == null)
{
AddToPhysicalScene(false);
}
m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
ParentPosition = Vector3.Zero;
@ -1987,9 +1926,8 @@ namespace OpenSim.Region.Framework.Scenes
return targetPart;
}
private void SendSitResponse(IClientAPI remoteClient, UUID targetID, Vector3 offset, Quaternion pSitOrientation)
private void SendSitResponse(UUID targetID, Vector3 offset, Quaternion pSitOrientation)
{
bool autopilot = true;
Vector3 pos = new Vector3();
Quaternion sitOrientation = pSitOrientation;
Vector3 cameraEyeOffset = Vector3.Zero;
@ -1997,8 +1935,9 @@ namespace OpenSim.Region.Framework.Scenes
bool forceMouselook = false;
SceneObjectPart part = FindNextAvailableSitTarget(targetID);
if (part != null)
{
if (part == null)
return;
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
// see http://wiki.secondlife.com/wiki/User:Andrew_Linden/Office_Hours/2007_11_06 for details on how LL does it
@ -2019,67 +1958,64 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
if (SitTargetisSet && SitTargetUnOccupied)
if (PhysicsActor != null)
m_sitAvatarHeight = m_physicsActor.Size.Z;
bool canSit = false;
pos = part.AbsolutePosition + offset;
if (SitTargetisSet)
{
if (SitTargetUnOccupied)
{
m_log.DebugFormat(
"[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is set and unoccupied",
Name, part.Name, part.LocalId);
part.SitTargetAvatar = UUID;
offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z);
sitOrientation = avSitOrientation;
autopilot = false;
}
pos = part.AbsolutePosition + offset;
//if (Math.Abs(part.AbsolutePosition.Z - AbsolutePosition.Z) > 1)
//{
// offset = pos;
//autopilot = false;
//}
if (PhysicsActor != null)
{
// If we're not using the client autopilot, we're immediately warping the avatar to the location
// We can remove the physicsActor until they stand up.
m_sitAvatarHeight = PhysicsActor.Size.Z;
if (autopilot)
{
if (Util.GetDistanceTo(AbsolutePosition, pos) < 4.5)
{
autopilot = false;
RemoveFromPhysicalScene();
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
canSit = true;
}
}
else
{
RemoveFromPhysicalScene();
if (Util.GetDistanceTo(AbsolutePosition, pos) <= 10)
{
m_log.DebugFormat(
"[SCENE PRESENCE]: Sitting {0} on {1} {2} because sit target is unset and within 10m",
Name, part.Name, part.LocalId);
AbsolutePosition = pos + new Vector3(0.0f, 0.0f, m_sitAvatarHeight);
canSit = true;
}
}
if (canSit)
{
if (PhysicsActor != null)
{
// We can remove the physicsActor until they stand up.
RemoveFromPhysicalScene();
}
cameraAtOffset = part.GetCameraAtOffset();
cameraEyeOffset = part.GetCameraEyeOffset();
forceMouselook = part.GetForceMouselook();
}
ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
ControllingClient.SendSitResponse(
targetID, offset, sitOrientation, false, cameraAtOffset, cameraEyeOffset, forceMouselook);
m_requestedSitTargetUUID = targetID;
// This calls HandleAgentSit twice, once from here, and the client calls
// HandleAgentSit itself after it gets to the location
// It doesn't get to the location until we've moved them there though
// which happens in HandleAgentSit :P
m_autopilotMoving = autopilot;
m_autoPilotTarget = pos;
m_sitAtAutoTarget = autopilot;
if (!autopilot)
HandleAgentSit(remoteClient, UUID);
HandleAgentSit(ControllingClient, UUID);
// Moved here to avoid a race with default sit anim
// The script event needs to be raised after the default sit anim is set.
if (part != null)
part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK);
}
}
// public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
{
if (ParentID != 0)
@ -2105,11 +2041,11 @@ namespace OpenSim.Region.Framework.Scenes
{
m_nextSitAnimation = part.SitAnimation;
}
m_requestedSitTargetID = part.LocalId;
//m_requestedSitOffset = offset;
m_requestedSitTargetUUID = targetID;
m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
// m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
if (m_scene.PhysicsScene.SupportsRayCast())
{
@ -2123,7 +2059,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
}
SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
SendSitResponse(targetID, offset, Quaternion.Identity);
}
/*
@ -2334,8 +2270,6 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
if (m_sitAtAutoTarget || !m_autopilotMoving)
{
if (part != null)
{
if (part.SitTargetAvatar == UUID)
@ -2372,7 +2306,6 @@ namespace OpenSim.Region.Framework.Scenes
{
return;
}
}
ParentID = m_requestedSitTargetID;
@ -2383,6 +2316,19 @@ namespace OpenSim.Region.Framework.Scenes
SendAvatarDataToAllAgents();
}
public void HandleAgentSitOnGround()
{
m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
// TODO: This doesn't prevent the user from walking yet.
// Setting parent ID would fix this, if we knew what value
// to use. Or we could add a m_isSitting variable.
//Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
SitGround = true;
RemoveFromPhysicalScene();
}
/// <summary>
/// Event handler for the 'Always run' setting on the client
/// Tells the physics plugin to increase speed of movement.

View File

@ -0,0 +1,176 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using System.Threading;
namespace OpenSim.Region.Framework.Scenes.Tests
{
[TestFixture]
public class ScenePresenceSitTests
{
private TestScene m_scene;
private ScenePresence m_sp;
[SetUp]
public void Init()
{
m_scene = SceneHelpers.SetupScene();
m_sp = SceneHelpers.AddScenePresence(m_scene, TestHelpers.ParseTail(0x1));
}
[Test]
public void TestSitOutsideRangeNoTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// More than 10 meters away from 0, 0, 0 (default part position)
Vector3 startPos = new Vector3(10.1f, 0, 0);
m_sp.AbsolutePosition = startPos;
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(0));
}
[Test]
public void TestSitWithinRangeNoTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// Less than 10 meters away from 0, 0, 0 (default part position)
Vector3 startPos = new Vector3(9.9f, 0, 0);
m_sp.AbsolutePosition = startPos;
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
}
[Test]
public void TestSitAndStandWithNoSitTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// Make sure we're within range to sit
Vector3 startPos = new Vector3(1, 1, 1);
m_sp.AbsolutePosition = startPos;
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
Assert.That(m_sp.PhysicsActor, Is.Null);
// FIXME: This is different for live avatars - z position is adjusted. This is half the height of the
// default avatar.
// Curiously, Vector3.ToString() will not display the last two places of the float. For example,
// printing out npc.AbsolutePosition will give <0, 0, 0.8454993> not <0, 0, 0.845499337>
Assert.That(
m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + new Vector3(0, 0, 0.845499337f)));
m_sp.StandUp();
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(0));
Assert.That(m_sp.PhysicsActor, Is.Not.Null);
}
[Test]
public void TestSitAndStandWithSitTarget()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// If a prim has a sit target then we can sit from any distance away
Vector3 startPos = new Vector3(128, 128, 30);
m_sp.AbsolutePosition = startPos;
SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene);
part.SitTargetPosition = new Vector3(0, 0, 1);
m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero);
Assert.That(part.SitTargetAvatar, Is.EqualTo(m_sp.UUID));
Assert.That(m_sp.ParentID, Is.EqualTo(part.LocalId));
Assert.That(
m_sp.AbsolutePosition,
Is.EqualTo(part.AbsolutePosition + part.SitTargetPosition + ScenePresence.SIT_TARGET_ADJUSTMENT));
Assert.That(m_sp.PhysicsActor, Is.Null);
m_sp.StandUp();
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
Assert.That(m_sp.ParentID, Is.EqualTo(0));
Assert.That(m_sp.PhysicsActor, Is.Not.Null);
}
[Test]
public void TestSitAndStandOnGround()
{
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
// If a prim has a sit target then we can sit from any distance away
// Vector3 startPos = new Vector3(128, 128, 30);
// sp.AbsolutePosition = startPos;
m_sp.HandleAgentSitOnGround();
Assert.That(m_sp.SitGround, Is.True);
Assert.That(m_sp.PhysicsActor, Is.Null);
m_sp.StandUp();
Assert.That(m_sp.SitGround, Is.False);
Assert.That(m_sp.PhysicsActor, Is.Not.Null);
}
}
}

View File

@ -125,6 +125,13 @@ namespace OpenSim.Services.AuthenticationService
m_log.DebugFormat("[PASS AUTH]: {0} {1} impersonating {2}, proceeding with login", a.FirstName, a.LastName, principalID);
return GetToken(principalID, lifetime);
}
else
{
m_log.DebugFormat(
"[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.",
principalID);
return String.Empty;
}
}
m_log.DebugFormat("[PASS AUTH]: Impersonation of {0} failed", principalID);