Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

varregion
Diva Canto 2013-08-24 03:42:39 -07:00
commit 5cd7bc2848
12 changed files with 132 additions and 84 deletions

View File

@ -67,7 +67,7 @@ namespace OpenSim.Framework.Monitoring
if (cmd[3] == "start") if (cmd[3] == "start")
{ {
Start(); Start();
con.OutputFormat("Now recording all stats very {0}ms to file", m_statsLogIntervalMs); con.OutputFormat("Now recording all stats to file every {0}ms", m_statsLogIntervalMs);
} }
else if (cmd[3] == "stop") else if (cmd[3] == "stop")
{ {

View File

@ -12602,7 +12602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
if (p is ScenePresence) if (p is ScenePresence)
{ {
ScenePresence presence = p as ScenePresence;
// It turns out to get the agent to stop flying, you have to feed it stop flying velocities // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
// There's no explicit message to send the client to tell it to stop flying.. it relies on the // There's no explicit message to send the client to tell it to stop flying.. it relies on the
// velocity, collision plane and avatar height // velocity, collision plane and avatar height
@ -12610,15 +12609,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Add 1/6 the avatar's height to it's position so it doesn't shoot into the air // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
// when the avatar stands up // when the avatar stands up
Vector3 pos = presence.AbsolutePosition;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock block = ImprovedTerseObjectUpdatePacket.ObjectDataBlock block =
CreateImprovedTerseBlock(p, false); CreateImprovedTerseBlock(p, false);
const float TIME_DILATION = 1.0f; const float TIME_DILATION = 1.0f;
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f); ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
ImprovedTerseObjectUpdatePacket packet ImprovedTerseObjectUpdatePacket packet
= (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket( = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
PacketType.ImprovedTerseObjectUpdate); PacketType.ImprovedTerseObjectUpdate);

View File

@ -536,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e.Message); m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e);
return null; return null;
} }
} }

View File

@ -832,8 +832,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
m_log.WarnFormat( m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}",
sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); sp.Name, finalDestination.RegionName, sp.Scene.Name);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
return; return;
@ -1053,8 +1053,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
m_log.WarnFormat( m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Keeping avatar in {2}",
sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); sp.Name, finalDestination.RegionName, sp.Scene.Name);
Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established."); Fail(sp, finalDestination, logout, currentAgentCircuit.SessionID.ToString(), "Connection between viewer and destination region could not be established.");
return; return;

View File

@ -4416,10 +4416,27 @@ namespace OpenSim.Region.Framework.Scenes
// Check that the auth_token is valid // Check that the auth_token is valid
AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID); AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID);
if (acd != null && acd.SessionID.ToString() == auth_token)
if (acd == null)
{
m_log.DebugFormat(
"[SCENE]: Request to close agent {0} but no such agent in scene {1}. May have been closed previously.",
agentID, Name);
return false;
}
if (acd.SessionID.ToString() == auth_token)
{
return IncomingCloseAgent(agentID, force); return IncomingCloseAgent(agentID, force);
}
else else
m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token); {
m_log.WarnFormat(
"[SCENE]: Request to close agent {0} with invalid authorization token {1} in {2}",
agentID, auth_token, Name);
}
return false; return false;
} }

View File

@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes
protected internal ScenePresence CreateAndAddChildScenePresence( protected internal ScenePresence CreateAndAddChildScenePresence(
IClientAPI client, AvatarAppearance appearance, PresenceType type) IClientAPI client, AvatarAppearance appearance, PresenceType type)
{ {
ScenePresence newAvatar = null;
// ScenePresence always defaults to child agent // ScenePresence always defaults to child agent
newAvatar = new ScenePresence(client, m_parentScene, appearance, type); ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type);
AddScenePresence(newAvatar);
return newAvatar;
}
/// <summary>
/// Add a presence to the scene
/// </summary>
/// <param name="presence"></param>
protected internal void AddScenePresence(ScenePresence presence)
{
// Always a child when added to the scene
bool child = presence.IsChildAgent;
if (child)
{
m_numChildAgents++;
}
else
{
m_numRootAgents++;
presence.AddToPhysicalScene(false);
}
Entities[presence.UUID] = presence; Entities[presence.UUID] = presence;
lock (m_presenceLock) lock (m_presenceLock)
{ {
m_numChildAgents++;
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap); Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray); List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
// Remember the old presene reference from the dictionary // Remember the old presence reference from the dictionary
ScenePresence oldref = newmap[presence.UUID]; ScenePresence oldref = newmap[presence.UUID];
// Replace the presence reference in the dictionary with the new value // Replace the presence reference in the dictionary with the new value
newmap[presence.UUID] = presence; newmap[presence.UUID] = presence;
@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceMap = newmap; m_scenePresenceMap = newmap;
m_scenePresenceArray = newlist; m_scenePresenceArray = newlist;
} }
return presence;
} }
/// <summary> /// <summary>

View File

@ -3243,11 +3243,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void RestoreInCurrentScene()
{
AddToPhysicalScene(false); // not exactly false
}
public void Reset() public void Reset()
{ {
// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName); // m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName);

View File

@ -119,11 +119,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand
foreach (ScenePresence sp in scenePresences) foreach (ScenePresence sp in scenePresences)
{ {
if (sp.SitGround || sp.IsSatOnObject)
continue;
SceneObjectPart sitPart = null; SceneObjectPart sitPart = null;
List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups(); List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
foreach (SceneObjectGroup sceneObject in sceneObjects) foreach (SceneObjectGroup sceneObject in sceneObjects)
{ {
if (sceneObject.IsAttachment)
continue;
foreach (SceneObjectPart part in sceneObject.Parts) foreach (SceneObjectPart part in sceneObject.Parts)
{ {
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero) if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
@ -168,11 +174,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand
List<ScenePresence> scenePresences = GetScenePresences(cmd); List<ScenePresence> scenePresences = GetScenePresences(cmd);
foreach (ScenePresence sp in scenePresences) foreach (ScenePresence sp in scenePresences)
{
if (sp.SitGround || sp.IsSatOnObject)
{ {
MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name); MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name);
sp.StandUp(); sp.StandUp();
} }
} }
}
private List<ScenePresence> GetScenePresences(string[] cmdParams) private List<ScenePresence> GetScenePresences(string[] cmdParams)
{ {

View File

@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService
{ {
MainConsole.Instance.Commands.AddCommand("Regions", true, MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region id", "deregister region id",
"deregister region id <Region UUID>", "deregister region id <region-id>+",
"Deregister a region manually.", "Deregister a region manually.",
String.Empty, String.Empty,
HandleDeregisterRegion); HandleDeregisterRegion);
@ -526,13 +526,15 @@ namespace OpenSim.Services.GridService
private void HandleDeregisterRegion(string module, string[] cmd) private void HandleDeregisterRegion(string module, string[] cmd)
{ {
if (cmd.Length != 4) if (cmd.Length < 4)
{ {
MainConsole.Instance.Output("Syntax: degregister region id <Region UUID>"); MainConsole.Instance.Output("Usage: degregister region id <region-id>+");
return; return;
} }
string rawRegionUuid = cmd[3]; for (int i = 3; i < cmd.Length; i++)
{
string rawRegionUuid = cmd[i];
UUID regionUuid; UUID regionUuid;
if (!UUID.TryParse(rawRegionUuid, out regionUuid)) if (!UUID.TryParse(rawRegionUuid, out regionUuid))
@ -558,8 +560,7 @@ namespace OpenSim.Services.GridService
// I don't think this can ever occur if we know that the region exists. // I don't think this can ever occur if we know that the region exists.
MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid); MainConsole.Instance.OutputFormat("Error deregistering {0} {1}", region.RegionName, regionUuid);
} }
}
return;
} }
private void HandleShowRegions(string module, string[] cmd) private void HandleShowRegions(string module, string[] cmd)

View File

@ -202,6 +202,9 @@ namespace pCampBot
"bot", false, "stand", "stand", "Stand all bots.", "bot", false, "stand", "stand", "Stand all bots.",
HandleStand); HandleStand);
m_console.Commands.AddCommand(
"bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);
m_console.Commands.AddCommand( m_console.Commands.AddCommand(
"bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions); "bot", false, "show regions", "show regions", "Show regions known to bots", HandleShowRegions);
@ -209,7 +212,7 @@ namespace pCampBot
"bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus); "bot", false, "show bots", "show bots", "Shows the status of all bots", HandleShowBotsStatus);
m_console.Commands.AddCommand( m_console.Commands.AddCommand(
"bot", false, "show bot", "show bot <first-name> <last-name>", "bot", false, "show bot", "show bot <n>",
"Shows the detailed status and settings of a particular bot.", HandleShowBotStatus); "Shows the detailed status and settings of a particular bot.", HandleShowBotStatus);
m_bots = new List<Bot>(); m_bots = new List<Bot>();
@ -274,11 +277,11 @@ namespace pCampBot
connectBotThread.Start(); connectBotThread.Start();
} }
private void ConnectBotsInternal(int botcount) private void ConnectBotsInternal(int botCount)
{ {
MainConsole.Instance.OutputFormat( MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>", "[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>",
botcount, botCount,
m_loginUri, m_loginUri,
m_startUri, m_startUri,
m_firstName, m_firstName,
@ -288,7 +291,9 @@ namespace pCampBot
MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates); MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures); MainConsole.Instance.OutputFormat("[BOT MANAGER]: InitBotRequestObjectTextures is {0}", InitBotRequestObjectTextures);
for (int i = 0; i < botcount; i++) int connectedBots = 0;
for (int i = 0; i < m_bots.Count; i++)
{ {
lock (m_bots) lock (m_bots)
{ {
@ -299,12 +304,19 @@ namespace pCampBot
break; break;
} }
if (m_bots[i].ConnectionState == ConnectionState.Disconnected)
{
m_bots[i].Connect(); m_bots[i].Connect();
} connectedBots++;
if (connectedBots >= botCount)
break;
// Stagger logins // Stagger logins
Thread.Sleep(LoginDelay); Thread.Sleep(LoginDelay);
} }
}
}
ConnectingBots = false; ConnectingBots = false;
} }
@ -518,6 +530,30 @@ namespace pCampBot
Environment.Exit(0); Environment.Exit(0);
} }
private void HandleSetBots(string module, string[] cmd)
{
string key = cmd[2];
string rawValue = cmd[3];
if (key == "SEND_AGENT_UPDATES")
{
bool newSendAgentUpdatesSetting;
if (!ConsoleUtil.TryParseConsoleBool(MainConsole.Instance, rawValue, out newSendAgentUpdatesSetting))
return;
MainConsole.Instance.OutputFormat(
"Setting SEND_AGENT_UPDATES to {0} for all bots", newSendAgentUpdatesSetting);
lock (m_bots)
m_bots.ForEach(b => b.Client.Settings.SEND_AGENT_UPDATES = newSendAgentUpdatesSetting);
}
else
{
MainConsole.Instance.Output("Error: Only setting currently available is SEND_AGENT_UPDATES");
}
}
private void HandleShowRegions(string module, string[] cmd) private void HandleShowRegions(string module, string[] cmd)
{ {
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}"; string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
@ -569,13 +605,18 @@ namespace pCampBot
private void HandleShowBotStatus(string module, string[] cmd) private void HandleShowBotStatus(string module, string[] cmd)
{ {
if (cmd.Length != 4) if (cmd.Length != 3)
{ {
MainConsole.Instance.Output("Usage: show bot <first-name> <last-name>"); MainConsole.Instance.Output("Usage: show bot <n>");
return; return;
} }
string name = string.Format("{0} {1}", cmd[2], cmd[3]); int botNumber;
if (!ConsoleUtil.TryParseConsoleInt(MainConsole.Instance, cmd[2], out botNumber))
return;
string name = string.Format("{0} {1}_{2}", m_firstName, m_lastNameStem, botNumber);
Bot bot; Bot bot;

View File

@ -82,6 +82,13 @@ namespace pCampBot
IConfigSource configSource = new IniConfigSource(iniFilePath); IConfigSource configSource = new IniConfigSource(iniFilePath);
IConfig botManagerConfig = configSource.Configs["BotManager"];
if (botManagerConfig != null)
{
bm.LoginDelay = botManagerConfig.GetInt("LoginDelay", bm.LoginDelay);
}
IConfig botConfig = configSource.Configs["Bot"]; IConfig botConfig = configSource.Configs["Bot"];
if (botConfig != null) if (botConfig != null)

View File

@ -1,6 +1,10 @@
; This is the example config file for pCampbot ; This is the example config file for pCampbot
; To use it, copy this file to pCampbot.ini and change settings if required ; To use it, copy this file to pCampbot.ini and change settings if required
[BotManager]
; Number of milliseconds to wait between bot logins
LoginDelay = 5000
[Bot] [Bot]
; Control whether bots should regularly send agent updates ; Control whether bots should regularly send agent updates
; Not doing this will reduce CPU requirements for pCampbot but greatly ; Not doing this will reduce CPU requirements for pCampbot but greatly