Change teleports so the TeleportFlags are sent to the destination sim. It

can now determine if a connection is from login, teleport or crossing.
Needed for a meaningful banlines implementation
mysql-performance
Melanie 2009-12-29 18:35:06 +00:00
parent bca2afdb3c
commit 0b5cdc539c
13 changed files with 44 additions and 26 deletions

View File

@ -268,7 +268,7 @@ namespace OpenSim.Client.Linden
else
{
string reason;
if (scene.NewUserConnection(agentData, out reason))
if (scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{
success = true;
}

View File

@ -199,7 +199,7 @@ namespace OpenSim.Client.Linden
Scene scene;
if (TryGetRegion(regionHandle, out scene))
{
return scene.NewUserConnection(agent, out reason);
return scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
}
reason = "Region not found.";
return false;

View File

@ -609,7 +609,7 @@ namespace OpenSim.Client.MXP.PacketHandler
agent.Appearance = new AvatarAppearance();
}
return scene.NewUserConnection(agent, out reason);
return scene.NewUserConnection(agent, 0, out reason);
}
public void PrintDebugInformation()

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason)
public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, uint teleportFlags, out string reason)
{
reason = String.Empty;
@ -83,7 +83,8 @@ namespace OpenSim.Framework.Communications.Clients
}
// Add the regionhandle of the destination region
ulong regionHandle = GetRegionHandle(region.RegionHandle);
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
args["destination_handle"] = OSD.FromString(regionHandle.ToString());
args["teleport_flags"] = OSD.FromString(teleportFlags.ToString());
string strBuffer = "";
byte[] buffer = new byte[1];

View File

@ -557,7 +557,7 @@ namespace OpenSim.Region.CoreModules.InterGrid
// Call 'new user' event handler
string reason;
if (!homeScene.NewUserConnection(agentData, out reason))
if (!homeScene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
{
responseMap["connect"] = OSD.FromBoolean(false);
responseMap["message"] = OSD.FromString(String.Format("Connection refused: {0}", reason));

View File

@ -144,7 +144,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
{
foreach (Scene s in m_sceneList)
@ -152,7 +152,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
if (s.RegionInfo.RegionHandle == regionHandle)
{
// m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle);
return s.NewUserConnection(aCircuit, out reason);
return s.NewUserConnection(aCircuit, teleportFlags, out reason);
}
}

View File

@ -157,10 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
* Agent-related communications
*/
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason)
public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason)
{
// Try local first
if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason))
if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, teleportFlags, out reason))
return true;
// else do the remote thing
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
{
m_regionClient.SendUserInformation(regInfo, aCircuit);
return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason);
return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", teleportFlags, out reason);
}
//else
// m_log.Warn("[REST COMMS]: Region not found " + regionHandle);
@ -436,11 +436,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion
}
OSDMap resp = new OSDMap(2);
string reason = String.Empty;
string reason = String.Empty;
uint teleportFlags = 0;
if (args.ContainsKey("teleport_flags"))
{
teleportFlags = args["teleport_flags"].AsUInteger();
}
// This is the meaning of POST agent
m_regionClient.AdjustUserInformation(aCircuit);
bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason);
bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, teleportFlags, out reason);
resp["reason"] = OSD.FromString(reason);
resp["success"] = OSD.FromBoolean(result);

View File

@ -37,7 +37,7 @@ namespace OpenSim.Region.Framework.Interfaces
{
#region Agents
bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason);
bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, uint teleportFlags, out string reason);
/// <summary>
/// Full child agent update.

View File

@ -203,7 +203,7 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
string reason = String.Empty;
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
{
avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason));

View File

@ -3316,12 +3316,16 @@ namespace OpenSim.Region.Framework.Scenes
/// Use NewUserConnection() directly if possible so the return type can refuse connections.
/// At the moment nothing actually seems to use this event,
/// as everything is switching to calling the NewUserConnection method directly.
///
/// Now obsoleting this because it doesn't handle teleportFlags propertly
///
/// </summary>
/// <param name="agent"></param>
[Obsolete("Please call NewUserConnection directly.")]
public void HandleNewUserConnection(AgentCircuitData agent)
{
string reason;
NewUserConnection(agent, out reason);
NewUserConnection(agent, 0, out reason);
}
/// <summary>
@ -3334,8 +3338,16 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="reason">Outputs the reason for the false response on this string</param>
/// <returns>True if the region accepts this agent. False if it does not. False will
/// also return a reason.</returns>
public bool NewUserConnection(AgentCircuitData agent, out string reason)
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
{
//Teleport flags:
//
// TeleportFlags.ViaGodlikeLure - Border Crossing
// TeleportFlags.ViaLogin - Login
// TeleportFlags.TeleportFlags.ViaLure - Teleport request sent by another user
// TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
if (loginsdisabled)
{
reason = "Logins Disabled";
@ -3343,9 +3355,9 @@ namespace OpenSim.Region.Framework.Scenes
}
// 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})",
"[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);
agent.AgentID, agent.circuitcode, teleportFlags);
reason = String.Empty;
if (!AuthenticateUser(agent, out reason))

View File

@ -286,7 +286,7 @@ namespace OpenSim.Region.Framework.Scenes
string reason = String.Empty;
bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, out reason);
bool regionAccepted = m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, a, 0, out reason);
if (regionAccepted && newAgent)
{
@ -810,7 +810,7 @@ namespace OpenSim.Region.Framework.Scenes
// Let's create an agent there if one doesn't exist yet.
//if (!m_commsProvider.InterRegion.InformRegionOfChildAgent(reg.RegionHandle, agentCircuit))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, out reason))
if (!m_interregionCommsOut.SendCreateChildAgent(reg.RegionHandle, agentCircuit, teleportFlags, out reason))
{
avatar.ControllingClient.SendTeleportFailed(String.Format("Destination is not accepting teleports: {0}",
reason));

View File

@ -117,7 +117,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
agent.child = true;
string reason;
scene.NewUserConnection(agent, out reason);
scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
testclient = new TestClient(agent, scene);
scene.AddNewClient(testclient);
@ -153,7 +153,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
if (acd1 == null)
fixNullPresence();
scene.NewUserConnection(acd1, out reason);
scene.NewUserConnection(acd1, 0, out reason);
if (testclient == null)
testclient = new TestClient(acd1, scene);
scene.AddNewClient(testclient);
@ -242,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Adding child agent to region 1001
string reason;
scene2.NewUserConnection(acd1, out reason);
scene2.NewUserConnection(acd1,0, out reason);
scene2.AddNewClient(testclient);
ScenePresence presence = scene.GetScenePresence(agent1);

View File

@ -382,7 +382,7 @@ namespace OpenSim.Tests.Common.Setup
// We emulate the proper login sequence here by doing things in three stages
// Stage 1: simulate login by telling the scene to expect a new user connection
scene.NewUserConnection(agentData, out reason);
scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason);
// Stage 2: add the new client as a child agent to the scene
TestClient client = new TestClient(agentData, scene);