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")
{
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")
{

View File

@ -12602,7 +12602,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
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
// 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
@ -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
// when the avatar stands up
Vector3 pos = presence.AbsolutePosition;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock block =
CreateImprovedTerseBlock(p, false);
const float TIME_DILATION = 1.0f;
ushort timeDilation = Utils.FloatToUInt16(TIME_DILATION, 0.0f, 1.0f);
ImprovedTerseObjectUpdatePacket packet
= (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(
PacketType.ImprovedTerseObjectUpdate);

View File

@ -536,7 +536,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
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;
}
}

View File

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

View File

@ -4416,10 +4416,27 @@ namespace OpenSim.Region.Framework.Scenes
// Check that the auth_token is valid
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);
}
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;
}

View File

@ -561,39 +561,15 @@ namespace OpenSim.Region.Framework.Scenes
protected internal ScenePresence CreateAndAddChildScenePresence(
IClientAPI client, AvatarAppearance appearance, PresenceType type)
{
ScenePresence newAvatar = null;
// ScenePresence always defaults to child agent
newAvatar = 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);
}
ScenePresence presence = new ScenePresence(client, m_parentScene, appearance, type);
Entities[presence.UUID] = presence;
lock (m_presenceLock)
{
m_numChildAgents++;
Dictionary<UUID, ScenePresence> newmap = new Dictionary<UUID, ScenePresence>(m_scenePresenceMap);
List<ScenePresence> newlist = new List<ScenePresence>(m_scenePresenceArray);
@ -604,7 +580,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
// Remember the old presene reference from the dictionary
// Remember the old presence reference from the dictionary
ScenePresence oldref = newmap[presence.UUID];
// Replace the presence reference in the dictionary with the new value
newmap[presence.UUID] = presence;
@ -616,6 +592,8 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresenceMap = newmap;
m_scenePresenceArray = newlist;
}
return presence;
}
/// <summary>

View File

@ -3243,11 +3243,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void RestoreInCurrentScene()
{
AddToPhysicalScene(false); // not exactly false
}
public void Reset()
{
// 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)
{
if (sp.SitGround || sp.IsSatOnObject)
continue;
SceneObjectPart sitPart = null;
List<SceneObjectGroup> sceneObjects = m_scene.GetSceneObjectGroups();
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
if (sceneObject.IsAttachment)
continue;
foreach (SceneObjectPart part in sceneObject.Parts)
{
if (part.IsSitTargetSet && part.SitTargetAvatar == UUID.Zero)
@ -169,8 +175,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.SitStand
foreach (ScenePresence sp in scenePresences)
{
MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name);
sp.StandUp();
if (sp.SitGround || sp.IsSatOnObject)
{
MainConsole.Instance.OutputFormat("Standing {0} in {1}", sp.Name, m_scene.Name);
sp.StandUp();
}
}
}

View File

@ -86,7 +86,7 @@ namespace OpenSim.Services.GridService
{
MainConsole.Instance.Commands.AddCommand("Regions", true,
"deregister region id",
"deregister region id <Region UUID>",
"deregister region id <region-id>+",
"Deregister a region manually.",
String.Empty,
HandleDeregisterRegion);
@ -526,40 +526,41 @@ namespace OpenSim.Services.GridService
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;
}
string rawRegionUuid = cmd[3];
UUID regionUuid;
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
for (int i = 3; i < cmd.Length; i++)
{
MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid);
return;
}
string rawRegionUuid = cmd[i];
UUID regionUuid;
GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid);
if (!UUID.TryParse(rawRegionUuid, out regionUuid))
{
MainConsole.Instance.OutputFormat("{0} is not a valid region uuid", rawRegionUuid);
return;
}
if (region == null)
{
MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
return;
}
GridRegion region = GetRegionByUUID(UUID.Zero, regionUuid);
if (DeregisterRegion(regionUuid))
{
MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid);
}
else
{
// 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);
}
if (region == null)
{
MainConsole.Instance.OutputFormat("No region with UUID {0}", regionUuid);
return;
}
return;
if (DeregisterRegion(regionUuid))
{
MainConsole.Instance.OutputFormat("Deregistered {0} {1}", region.RegionName, regionUuid);
}
else
{
// 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);
}
}
}
private void HandleShowRegions(string module, string[] cmd)

View File

@ -202,6 +202,9 @@ namespace pCampBot
"bot", false, "stand", "stand", "Stand all bots.",
HandleStand);
m_console.Commands.AddCommand(
"bot", false, "set bots", "set bots <key> <value>", "Set a setting for all bots.", HandleSetBots);
m_console.Commands.AddCommand(
"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);
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);
m_bots = new List<Bot>();
@ -274,11 +277,11 @@ namespace pCampBot
connectBotThread.Start();
}
private void ConnectBotsInternal(int botcount)
private void ConnectBotsInternal(int botCount)
{
MainConsole.Instance.OutputFormat(
"[BOT MANAGER]: Starting {0} bots connecting to {1}, location {2}, named {3} {4}_<n>",
botcount,
botCount,
m_loginUri,
m_startUri,
m_firstName,
@ -288,7 +291,9 @@ namespace pCampBot
MainConsole.Instance.OutputFormat("[BOT MANAGER]: BotsSendAgentUpdates is {0}", InitBotSendAgentUpdates);
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)
{
@ -299,11 +304,18 @@ namespace pCampBot
break;
}
m_bots[i].Connect();
}
if (m_bots[i].ConnectionState == ConnectionState.Disconnected)
{
m_bots[i].Connect();
connectedBots++;
// Stagger logins
Thread.Sleep(LoginDelay);
if (connectedBots >= botCount)
break;
// Stagger logins
Thread.Sleep(LoginDelay);
}
}
}
ConnectingBots = false;
@ -518,6 +530,30 @@ namespace pCampBot
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)
{
string outputFormat = "{0,-30} {1, -20} {2, -5} {3, -5}";
@ -569,13 +605,18 @@ namespace pCampBot
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;
}
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;

View File

@ -82,6 +82,13 @@ namespace pCampBot
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"];
if (botConfig != null)

View File

@ -1,6 +1,10 @@
; This is the example config file for pCampbot
; 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]
; Control whether bots should regularly send agent updates
; Not doing this will reduce CPU requirements for pCampbot but greatly