Cleaned up a few more things related to incoming agents.
parent
37bd48c5a7
commit
dad6ba2448
|
@ -2637,18 +2637,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public override void AddNewClient(IClientAPI client)
|
public override void AddNewClient(IClientAPI client)
|
||||||
{
|
{
|
||||||
|
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
||||||
bool vialogin = false;
|
bool vialogin = false;
|
||||||
|
|
||||||
m_clientManager.Add(client);
|
if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
|
||||||
|
return;
|
||||||
|
|
||||||
|
vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
|
||||||
|
(aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
|
||||||
|
|
||||||
CheckHeartbeat();
|
CheckHeartbeat();
|
||||||
SubscribeToClientEvents(client);
|
|
||||||
ScenePresence presence;
|
ScenePresence presence;
|
||||||
|
|
||||||
if (m_restorePresences.ContainsKey(client.AgentId))
|
if (m_restorePresences.ContainsKey(client.AgentId))
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
|
m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName);
|
||||||
|
|
||||||
|
m_clientManager.Add(client);
|
||||||
|
SubscribeToClientEvents(client);
|
||||||
|
|
||||||
presence = m_restorePresences[client.AgentId];
|
presence = m_restorePresences[client.AgentId];
|
||||||
m_restorePresences.Remove(client.AgentId);
|
m_restorePresences.Remove(client.AgentId);
|
||||||
|
|
||||||
|
@ -2671,49 +2678,35 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
|
if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
|
||||||
|
|
||||||
//// Do the verification here -- No, really don't do this here. This is UDP address, let it go.
|
|
||||||
//System.Net.IPEndPoint ep = (System.Net.IPEndPoint)client.GetClientEP();
|
|
||||||
//if (aCircuit != null)
|
|
||||||
//{
|
|
||||||
// if (!VerifyClient(aCircuit, ep, out vialogin))
|
|
||||||
// {
|
|
||||||
// // uh-oh, this is fishy
|
|
||||||
// m_log.WarnFormat("[SCENE]: Agent {0} with session {1} connecting with unidentified end point {2}. Refusing service.",
|
|
||||||
// client.AgentId, client.SessionId, ep.ToString());
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// client.Close();
|
|
||||||
// }
|
|
||||||
// catch (Exception e)
|
|
||||||
// {
|
|
||||||
// m_log.DebugFormat("[SCENE]: Exception while closing aborted client: {0}", e.StackTrace);
|
|
||||||
// }
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
m_log.Debug("[Scene] Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
|
||||||
|
|
||||||
ScenePresence sp = CreateAndAddScenePresence(client);
|
|
||||||
if (aCircuit != null)
|
|
||||||
sp.Appearance = aCircuit.Appearance;
|
|
||||||
|
|
||||||
// HERE!!! Do the initial attachments right here
|
|
||||||
// first agent upon login is a root agent by design.
|
|
||||||
// All other AddNewClient calls find aCircuit.child to be true
|
|
||||||
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
|
||||||
{
|
{
|
||||||
sp.IsChildAgent = false;
|
m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
|
||||||
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
|
||||||
|
m_clientManager.Add(client);
|
||||||
|
SubscribeToClientEvents(client);
|
||||||
|
|
||||||
|
ScenePresence sp = CreateAndAddScenePresence(client);
|
||||||
|
if (aCircuit != null)
|
||||||
|
sp.Appearance = aCircuit.Appearance;
|
||||||
|
|
||||||
|
// HERE!!! Do the initial attachments right here
|
||||||
|
// first agent upon login is a root agent by design.
|
||||||
|
// All other AddNewClient calls find aCircuit.child to be true
|
||||||
|
if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
|
||||||
|
{
|
||||||
|
sp.IsChildAgent = false;
|
||||||
|
Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_LastLogin = Util.EnvironmentTickCount();
|
if (GetScenePresence(client.AgentId) != null)
|
||||||
EventManager.TriggerOnNewClient(client);
|
{
|
||||||
if (vialogin)
|
m_LastLogin = Util.EnvironmentTickCount();
|
||||||
EventManager.TriggerOnClientLogin(client);
|
EventManager.TriggerOnNewClient(client);
|
||||||
|
if (vialogin)
|
||||||
|
EventManager.TriggerOnClientLogin(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
|
private bool VerifyClient(AgentCircuitData aCircuit, System.Net.IPEndPoint ep, out bool vialogin)
|
||||||
|
@ -2740,8 +2733,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
|
else if ((aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0)
|
||||||
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
|
{
|
||||||
|
m_log.DebugFormat("[SCENE]: Incoming client {0} {1} in region {2} via regular login. Client IP verification not performed.",
|
||||||
aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
|
||||||
|
vialogin = true;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3437,7 +3433,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// also return a reason.</returns>
|
/// also return a reason.</returns>
|
||||||
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason)
|
||||||
{
|
{
|
||||||
TeleportFlags tp = (TeleportFlags)teleportFlags;
|
bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 ||
|
||||||
|
(teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0);
|
||||||
reason = String.Empty;
|
reason = String.Empty;
|
||||||
|
|
||||||
//Teleport flags:
|
//Teleport flags:
|
||||||
|
@ -3474,7 +3471,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
|
ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y);
|
||||||
|
|
||||||
//On login test land permisions
|
//On login test land permisions
|
||||||
if (tp == TeleportFlags.ViaLogin)
|
if (vialogin)
|
||||||
{
|
{
|
||||||
if (land != null && !TestLandRestrictions(agent, land, out reason))
|
if (land != null && !TestLandRestrictions(agent, land, out reason))
|
||||||
{
|
{
|
||||||
|
@ -3533,7 +3530,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agent.teleportFlags = teleportFlags;
|
agent.teleportFlags = teleportFlags;
|
||||||
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
|
||||||
|
|
||||||
if (tp == TeleportFlags.ViaLogin)
|
if (vialogin)
|
||||||
{
|
{
|
||||||
if (TestBorderCross(agent.startpos, Cardinals.E))
|
if (TestBorderCross(agent.startpos, Cardinals.E))
|
||||||
{
|
{
|
||||||
|
@ -3651,7 +3648,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
IPresenceService presence = RequestModuleInterface<IPresenceService>();
|
IPresenceService presence = RequestModuleInterface<IPresenceService>();
|
||||||
if (presence == null)
|
if (presence == null)
|
||||||
{
|
{
|
||||||
reason = String.Format("Failed to verify user {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
reason = String.Format("Failed to verify user presence in the grid for {0} {1} in region {2}. Presence service does not exist.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3659,7 +3656,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
if (pinfo == null)
|
if (pinfo == null)
|
||||||
{
|
{
|
||||||
reason = String.Format("Failed to verify user {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
reason = String.Format("Failed to verify user presence in the grid for {0} {1}, access denied to region {2}.", agent.firstname, agent.lastname, RegionInfo.RegionName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue