Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
avinationmerge
Melanie 2013-02-23 20:37:09 +00:00
commit e3ea2c4bee
18 changed files with 140 additions and 63 deletions

View File

@ -65,7 +65,7 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
string homeURI = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName); //cnf.GetString("HomeURI", string.Empty);
string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] { "Startup", m_ConfigName} ); //cnf.GetString("HomeURI", string.Empty);
if (homeURI == string.Empty)
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));

View File

@ -916,6 +916,44 @@ namespace OpenSim.Framework
return val;
}
/// <summary>
/// Gets the value of a configuration variable by looking into
/// multiple sections in order. The latter sections overwrite
/// any values previously found.
/// </summary>
/// <typeparam name="T">Type of the variable</typeparam>
/// <param name="config">The configuration object</param>
/// <param name="varname">The configuration variable</param>
/// <param name="sections">Ordered sequence of sections to look at</param>
/// <returns></returns>
public static T GetConfigVarFromSections<T>(IConfigSource config, string varname, string[] sections)
{
object val = default(T);
foreach (string section in sections)
{
IConfig cnf = config.Configs[section];
if (cnf == null)
continue;
if (typeof(T) == typeof(String))
{
if (val == null) // no null strings, please
val = string.Empty;
val = cnf.GetString(varname, (string)val);
}
else if (typeof(T) == typeof(Boolean))
val = cnf.GetBoolean(varname, (bool)val);
else if (typeof(T) == typeof(Int32))
val = cnf.GetInt(varname, (int)val);
else if (typeof(T) == typeof(float))
val = cnf.GetFloat(varname, (int)val);
else
m_log.WarnFormat("[UTIL]: Unhandled type {0}", typeof(T));
}
return (T)val;
}
#endregion
public static float Clip(float x, float min, float max)

View File

@ -65,7 +65,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
{
m_Enabled = true;
m_ThisGridURL = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "Messaging");
m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "Messaging"});
// Legacy. Remove soon!
m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL);
m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name);

View File

@ -180,13 +180,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!sp.Scene.Permissions.CanTeleport(sp.UUID))
return;
// Reset animations; the viewer does that in teleports.
sp.Animator.ResetAnimations();
string destinationRegionName = "(not found)";
// Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
// of whether the destination region completes the teleport.
if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2}@{3} - agent is already in transit.",
sp.Name, sp.UUID, position, regionHandle);
return;
}
try
{
// Reset animations; the viewer does that in teleports.
sp.Animator.ResetAnimations();
if (regionHandle == sp.Scene.RegionInfo.RegionHandle)
{
destinationRegionName = sp.Scene.RegionInfo.RegionName;
@ -195,12 +206,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
else // Another region possibly in another simulator
{
GridRegion finalDestination;
TeleportAgentToDifferentRegion(
sp, regionHandle, position, lookAt, teleportFlags, out finalDestination);
if (finalDestination != null)
destinationRegionName = finalDestination.RegionName;
GridRegion finalDestination = null;
try
{
TeleportAgentToDifferentRegion(
sp, regionHandle, position, lookAt, teleportFlags, out finalDestination);
}
finally
{
if (finalDestination != null)
destinationRegionName = finalDestination.RegionName;
}
}
}
catch (Exception e)
@ -210,11 +226,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
e.Message, e.StackTrace);
// Make sure that we clear the in-transit flag so that future teleport attempts don't always fail.
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
sp.ControllingClient.SendTeleportFailed("Internal error");
}
finally
{
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
}
}
/// <summary>
@ -230,15 +247,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
"[ENTITY TRANSFER MODULE]: Teleport for {0} to {1} within {2}",
sp.Name, position, sp.Scene.RegionInfo.RegionName);
if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring within region teleport request of {0} {1} to {2} - agent is already in transit.",
sp.Name, sp.UUID, position);
return;
}
// Teleport within the same region
if (IsOutsideRegion(sp.Scene, position) || position.Z < 0)
{
@ -287,7 +295,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp);
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
}
/// <summary>
@ -341,7 +348,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
//
// This is it
//
DoTeleport(sp, reg, finalDestination, position, lookAt, teleportFlags);
DoTeleportInternal(sp, reg, finalDestination, position, lookAt, teleportFlags);
//
//
//
@ -396,27 +403,54 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
&& Math.Abs(sourceRegion.RegionLocY - destRegion.RegionCoordY) <= MaxTransferDistance;
}
/// <summary>
/// Wraps DoTeleportInternal() and manages the transfer state.
/// </summary>
public void DoTeleport(
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
Vector3 position, Vector3 lookAt, uint teleportFlags)
{
// Record that this agent is in transit so that we can prevent simultaneous requests and do later detection
// of whether the destination region completes the teleport.
m_entityTransferStateMachine.SetInTransit(sp.UUID);
// if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
// {
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
// sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
//
// return;
// }
if (!m_entityTransferStateMachine.SetInTransit(sp.UUID))
{
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Ignoring teleport request of {0} {1} to {2} ({3}) {4}/{5} - agent is already in transit.",
sp.Name, sp.UUID, reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position);
return;
}
try
{
DoTeleportInternal(sp, reg, finalDestination, position, lookAt, teleportFlags);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, finalDestination.RegionName,
e.Message, e.StackTrace);
sp.ControllingClient.SendTeleportFailed("Internal error");
}
finally
{
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
}
}
/// <summary>
/// Teleports the agent to another region.
/// This method doesn't manage the transfer state; the caller must do that.
/// </summary>
private void DoTeleportInternal(
ScenePresence sp, GridRegion reg, GridRegion finalDestination,
Vector3 position, Vector3 lookAt, uint teleportFlags)
{
if (reg == null || finalDestination == null)
{
sp.ControllingClient.SendTeleportFailed("Unable to locate destination");
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
@ -436,8 +470,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sourceRegion.RegionName, sourceRegion.RegionLocX, sourceRegion.RegionLocY,
MaxTransferDistance));
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
@ -455,7 +487,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (endPoint == null || endPoint.Address == null)
{
sp.ControllingClient.SendTeleportFailed("Remote Region appears to be down");
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
return;
}
@ -477,7 +508,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out version, out reason))
{
sp.ControllingClient.SendTeleportFailed(reason);
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: {0} was stopped from teleporting from {1} to {2} because {3}",
@ -535,7 +565,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
{
sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Teleport of {0} from {1} to {2} was refused because {3}",
@ -689,8 +718,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
// sp.UUID);
// }
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
}
protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout)
@ -710,8 +737,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Scene.SimulationService.CloseAgent(finalDestination, sp.UUID);
sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout);
m_entityTransferStateMachine.ResetFromTransit(sp.UUID);
}
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
@ -1139,7 +1164,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
ReInstantiateScripts(agent);
agent.AddToPhysicalScene(isFlying);
m_entityTransferStateMachine.ResetFromTransit(agent.UUID);
return false;
}

View File

@ -88,11 +88,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
if (thisModuleConfig != null)
{
m_HomeURI = Util.GetConfigVarWithDefaultSection(source, "HomeURI", "HGInventoryAccessModule");
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(source, "GatekeeperURI", "HGInventoryAccessModule");
m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI", new string[] {"Startup", "HGInventoryAccessModule"});
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", new string[] {"Startup", "HGInventoryAccessModule"});
// Legacy. Renove soon!
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper);
m_OutboundPermission = thisModuleConfig.GetBoolean("OutboundPermission", true);
m_RestrictInventoryAccessAbroad = thisModuleConfig.GetBoolean("RestrictInventoryAccessAbroad", true);
}
else

View File

@ -113,7 +113,7 @@ namespace OpenSim.Region.DataSnapshot
try
{
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
string gatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService");
string gatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"});
// Legacy. Remove soon!
if (string.IsNullOrEmpty(gatekeeper))
{

View File

@ -703,6 +703,12 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_inTransit;
/// <summary>
/// This signals whether the presence is in transit between neighbouring regions.
/// </summary>
/// <remarks>
/// It is not set when the presence is teleporting or logging in/out directly to a region.
/// </remarks>
public bool IsInTransit
{
get { return m_inTransit; }

View File

@ -2173,7 +2173,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
IConfigSource config = m_ScriptEngine.ConfigSource;
string HomeURI = Util.GetConfigVarWithDefaultSection(config, "HomeURI", string.Empty);
string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[]{"Startup"});
if (!string.IsNullOrEmpty(HomeURI))
return HomeURI;
@ -2194,7 +2194,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1);
IConfigSource config = m_ScriptEngine.ConfigSource;
string gatekeeperURI = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", string.Empty);
string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup"});
if (!string.IsNullOrEmpty(gatekeeperURI))
return gatekeeperURI;

View File

@ -177,7 +177,7 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString());
}
string HomeURI = Util.GetConfigVarWithDefaultSection(m_Config, "HomeURI", string.Empty);
string HomeURI = Util.GetConfigVarFromSections<string>(m_Config, "HomeURI", new string[] {"Startup"});
if (!String.IsNullOrEmpty(HomeURI))
map["home"] = OSD.FromString(HomeURI);

View File

@ -128,7 +128,7 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
m_ThisGatekeeper = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GridService");
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"});
// Legacy. Remove soon!
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
try

View File

@ -96,7 +96,7 @@ namespace OpenSim.Services.HypergridService
UUID.TryParse(scope, out m_ScopeID);
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
m_ExternalName = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "GatekeeperService");
m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GatekeeperService"});
m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
m_ExternalName = m_ExternalName + "/";

View File

@ -81,7 +81,7 @@ namespace OpenSim.Services.HypergridService
if (m_UserAccountService == null)
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
m_HomeURL = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName);
m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName});
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
}

View File

@ -96,7 +96,7 @@ namespace OpenSim.Services.HypergridService
if (m_AvatarService == null)
throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
m_HomeURL = Util.GetConfigVarWithDefaultSection(config, "HomeURI", m_ConfigName);
m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName});
// m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
}

View File

@ -131,7 +131,7 @@ namespace OpenSim.Services.HypergridService
LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);
m_GridName = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "UserAgentService");
m_GridName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "UserAgentService"});
if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon.
{
m_GridName = serverConfig.GetString("ExternalName", string.Empty);

View File

@ -110,7 +110,7 @@ namespace OpenSim.Services.LLLoginService
m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
m_GatekeeperURL = Util.GetConfigVarWithDefaultSection(config, "GatekeeperURI", "LoginService");
m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "LoginService"});
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);

View File

@ -954,8 +954,13 @@
; StorageProvider = OpenSim.Data.MySQL.dll
;# {ServicesConnectorModule} {Module:GroupsModule Module:Groups Module V2} {Service connector to use for groups} {XmlRpcGroupsServicesConnector SimianGroupsServicesConnector "Groups Local Service Connector" "Groups Remote Service Connector" "Groups HG Service Connector"} XmlRpcGroupsServicesConnector
;; Service connectors to the Groups Service as used in the GroupsModule. Select one depending on
;; whether you're using a Flotsam XmlRpc backend or a SimianGrid backend or several flavours of V2, Hypergrided or not, standalone or grided.
;; Service connectors to the Groups Service as used in the GroupsModule. Select one as follows:
;; -- for Flotsam Groups use XmlRpcGroupsServicesConnector
;; -- for Simian Groups use SimianGroupsServicesConnector
;; -- for V2 Groups, standalone, non-HG use "Groups Local Service Connector"
;; -- for V2 Groups, grided sim, non-HG use "Groups Remote Service Connector"
;; -- for V2 Groups, HG, both standalone and grided sim, use "Groups HG Service Connector"
;; Note that the quotes "" around the words are important!
; ServicesConnectorModule = XmlRpcGroupsServicesConnector
;# {LocalService} {ServicesConnectorModule:Groups HG Service Connector} {Is the group service in this process or elsewhere?} {local remote} local
@ -967,6 +972,7 @@
;; e.g. http://yourxmlrpcserver.com/xmlrpc.php for Flotsam XmlRpc
;; or http://mygridserver.com:82/Grid/ for SimianGrid
;; or http:://mygridserver.com:8003 for robust, V2
;; Leave it commented for standalones, V2
; GroupsServerURI = ""
;# {HomeURI} {ServicesConnectorModule:Groups HG Service Connector} {What's the home address of this world?} {}

View File

@ -80,7 +80,7 @@ InstantMessageServerConnector = "8002/OpenSim.Server.Handlers.dll:InstantMessage
HGInventoryServiceConnector = "HGInventoryService@8002/OpenSim.Server.Handlers.dll:XInventoryInConnector"
HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:AssetServiceConnector"
;; Uncomment this if you want Groups V2, HG to work
; HGGroupsServiceConnector = "8002/Diva.Groups.dll:HGGroupsServiceRobustConnector"
; HGGroupsServiceConnector = "8002/OpenSim.Addons.Groups.dll:HGGroupsServiceRobustConnector"
;; Additions for other add-on modules. For example:
;; WifiServerConnector = "8002/Diva.Wifi.dll:WifiServerConnector"

View File

@ -381,3 +381,5 @@ MapGetServiceConnector = "8002/OpenSim.Server.Handlers.dll:MapGetServiceConnecto
; password help: optional: page providing password assistance for users of your grid
;password = http://127.0.0.1/password