* minor: Clean up of logging messages to make following the client login process easier

* documentation
0.6.0-stable
Justin Clarke Casey 2008-09-07 03:22:33 +00:00
parent ea8c18f63d
commit 78f831ef52
7 changed files with 113 additions and 61 deletions

View File

@ -30,14 +30,13 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
/// <summary>
/// Manage client circuits
/// </summary>
public class AgentCircuitManager
{
public Dictionary<uint, AgentCircuitData> AgentCircuits = new Dictionary<uint, AgentCircuitData>();
public AgentCircuitManager()
{
}
public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode)
{
AgentCircuitData validcircuit = null;
@ -74,6 +73,11 @@ namespace OpenSim.Framework
return (user);
}
/// <summary>
/// Add information about a new circuit.
/// </summary>
/// <param name="circuitCode"></param>
/// <param name="agentData"></param>
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{
if (AgentCircuits.ContainsKey(circuitCode))
@ -118,7 +122,6 @@ namespace OpenSim.Framework
/// </summary>
/// <param name="circuitcode"></param>
/// <param name="newcircuitcode"></param>
public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode)
{
lock (AgentCircuits)

View File

@ -309,7 +309,6 @@ namespace OpenSim.Grid.UserServer
{
bool responseSuccess = true;
if (GridResp.Value != null)
{
Hashtable resp = (Hashtable) GridResp.Value;

View File

@ -376,6 +376,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/* METHODS */
/// <summary>
/// Constructor
/// </summary>
/// <param name="remoteEP"></param>
/// <param name="scene"></param>
/// <param name="assetCache"></param>
/// <param name="packServer"></param>
/// <param name="authenSessions"></param>
/// <param name="agentId"></param>
/// <param name="sessionId"></param>
/// <param name="circuitCode"></param>
/// <param name="proxyEP"></param>
public LLClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, LLPacketServer packServer,
AgentCircuitManager authenSessions, UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
{
@ -417,7 +429,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_clientThread.Start();
ThreadTracker.Add(m_clientThread);
m_log.Info("[CLIENT]: Started up new thread to handle client UDP session");
m_log.DebugFormat("[CLIENT]: Started new UDP session thread for agent {0}, circuit {1}", agentId, circuitCode);
}
public void SetDebug(int newDebug)
@ -634,7 +646,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected virtual void ClientLoop()
{
m_log.Info("[CLIENT]: Entered loop");
m_log.Info("[CLIENT]: Entered main packet processing loop");
while (true)
{
LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue();
@ -729,7 +742,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary>
protected virtual void AuthUser()
{
//tell this thread we are using the culture set up for the sim (currently hardcoded to en_US)
//otherwise it will override this and use the system default
Culture.SetCurrentCulture();
@ -738,8 +750,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(m_cirpack.m_circuitCode.m_sessionId, m_cirpack.m_circuitCode.ID, m_cirpack.m_circuitCode.Code);
AuthenticateResponse sessionInfo =
m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId,
m_circuitCode);
m_authenticateSessionsHandler.AuthenticateSession(m_sessionId, m_agentId, m_circuitCode);
if (!sessionInfo.Authorised)
{
//session/circuit not authorised

View File

@ -70,17 +70,43 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_scene.ClientManager.InPacket(circuitCode, packet);
}
protected virtual IClientAPI CreateNewClient(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
ClientManager clientManager, IScene scene, AssetCache assetCache,
LLPacketServer packServer, AgentCircuitManager authenSessions,
UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
/// <summary>
/// Create a new client circuit
/// </summary>
/// <param name="remoteEP"></param>
/// <param name="initialcirpack"></param>
/// <param name="clientManager"></param>
/// <param name="scene"></param>
/// <param name="assetCache"></param>
/// <param name="packServer"></param>
/// <param name="authenSessions"></param>
/// <param name="agentId"></param>
/// <param name="sessionId"></param>
/// <param name="circuitCode"></param>
/// <param name="proxyEP"></param>
/// <returns></returns>
protected virtual IClientAPI CreateNewCircuit(EndPoint remoteEP, UseCircuitCodePacket initialcirpack,
ClientManager clientManager, IScene scene, AssetCache assetCache,
LLPacketServer packServer, AgentCircuitManager authenSessions,
UUID agentId, UUID sessionId, uint circuitCode, EndPoint proxyEP)
{
return
new LLClientView(remoteEP, scene, assetCache, packServer, authenSessions, agentId, sessionId, circuitCode, proxyEP);
}
/// <summary>
/// Add a new client circuit
/// </summary>
/// <param name="epSender"></param>
/// <param name="useCircuit"></param>
/// <param name="assetCache"></param>
/// <param name="circuitManager"></param>
/// <param name="proxyEP"></param>
/// <returns>
/// true if a new circuit was created, false if a circuit with the given circuit code already existed
/// </returns>
public virtual bool AddNewClient(EndPoint epSender, UseCircuitCodePacket useCircuit, AssetCache assetCache,
AgentCircuitManager authenticateSessionsClass, EndPoint proxyEP)
AgentCircuitManager circuitManager, EndPoint proxyEP)
{
IClientAPI newuser;
@ -90,9 +116,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else
{
newuser = CreateNewClient(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
authenticateSessionsClass, useCircuit.CircuitCode.ID,
useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP);
newuser = CreateNewCircuit(epSender, useCircuit, m_scene.ClientManager, m_scene, assetCache, this,
circuitManager, useCircuit.CircuitCode.ID,
useCircuit.CircuitCode.SessionID, useCircuit.CircuitCode.Code, proxyEP);
m_scene.ClientManager.Add(useCircuit.CircuitCode.Code, newuser);

View File

@ -75,7 +75,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected IPAddress listenIP = IPAddress.Parse("0.0.0.0");
protected IScene m_localScene;
protected AssetCache m_assetCache;
protected AgentCircuitManager m_authenticateSessionsClass;
/// <value>
/// Manages authentication for agent circuits
/// </value>
protected AgentCircuitManager m_circuitManager;
public LLPacketServer PacketServer
{
@ -132,14 +136,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Initialise(_listenIP, ref port, proxyPortOffset, allow_alternate_port, assetCache, authenticateClass);
}
public void Initialise(IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager authenticateClass)
/// <summary>
/// Initialize the server
/// </summary>
/// <param name="_listenIP"></param>
/// <param name="port"></param>
/// <param name="proxyPortOffset"></param>
/// <param name="allow_alternate_port"></param>
/// <param name="assetCache"></param>
/// <param name="circuitManager"></param>
public void Initialise(
IPAddress _listenIP, ref uint port, int proxyPortOffset, bool allow_alternate_port, AssetCache assetCache, AgentCircuitManager circuitManager)
{
this.proxyPortOffset = proxyPortOffset;
listenPort = (uint) (port + proxyPortOffset);
listenIP = _listenIP;
Allow_Alternate_Port = allow_alternate_port;
m_assetCache = assetCache;
m_authenticateSessionsClass = authenticateClass;
m_circuitManager = circuitManager;
CreatePacketServer();
// Return new port
@ -177,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
// TODO : Actually only handle those states that we have control over, re-throw everything else,
// TODO: implement cases as we encounter them.
//m_log.Error("[UDPSERVER]: Connection Error! - " + e.ToString());
//m_log.Error("[[CLIENT]: ]: Connection Error! - " + e.ToString());
switch (e.SocketErrorCode)
{
case SocketError.AlreadyInProgress:
@ -193,7 +207,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (ObjectDisposedException e)
{
m_log.DebugFormat("ObjectDisposedException: Object {0} disposed.", e.ObjectName);
m_log.DebugFormat("[CLIENT]: ObjectDisposedException: Object {0} disposed.", e.ObjectName);
// Uhh, what object, and why? this needs better handling.
}
@ -213,15 +227,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (MalformedDataException e)
{
m_log.DebugFormat("Dropped Malformed Packet due to MalformedDataException: {0}", e.StackTrace);
m_log.DebugFormat("[CLIENT]: Dropped Malformed Packet due to MalformedDataException: {0}", e.StackTrace);
}
catch (IndexOutOfRangeException e)
{
m_log.DebugFormat("Dropped Malformed Packet due to IndexOutOfRangeException: {0}", e.StackTrace);
m_log.DebugFormat("[CLIENT]: Dropped Malformed Packet due to IndexOutOfRangeException: {0}", e.StackTrace);
}
catch (Exception e)
{
m_log.Debug("[UDPSERVER]: " + e.ToString());
m_log.Debug("[CLIENT]: " + e.ToString());
}
}
@ -249,8 +263,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else if (packet.Type == PacketType.UseCircuitCode)
{
// new client
m_log.Debug("[UDPSERVER]: Adding New Client");
AddNewClient(packet);
UseCircuitCodePacket p = (UseCircuitCodePacket)packet;
@ -267,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (Exception e)
{
m_log.Error("[UDPSERVER]: Exception in processing packet - ignoring: ", e);
m_log.Error("[CLIENT]: Exception in processing packet - ignoring: ", e);
}
}
}
@ -280,7 +292,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
catch (SocketException e)
{
m_log.ErrorFormat("[UDPSERVER]: BeginRecieve threw exception " + e.Message + ": " + e.StackTrace );
m_log.ErrorFormat("[CLIENT]: BeginRecieve threw exception " + e.Message + ": " + e.StackTrace );
ResetEndPoint();
}
}
@ -339,19 +351,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return;
UseCircuitCodePacket useCircuit = (UseCircuitCodePacket) packet;
m_log.DebugFormat("[CLIENT]: Adding new circuit for agent {0}, circuit code {1}", useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code);
lock (clientCircuits)
{
if (!clientCircuits.ContainsKey(epSender))
clientCircuits.Add(epSender, useCircuit.CircuitCode.Code);
else
m_log.Error("[UDPSERVER]: clientCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
m_log.Error("[CLIENT]: clientCircuits already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding.");
}
// This doesn't need locking as it's synchronized data
if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, epSender);
else
m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding.");
lock (proxyCircuits)
@ -359,10 +374,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!proxyCircuits.ContainsKey(useCircuit.CircuitCode.Code))
proxyCircuits.Add(useCircuit.CircuitCode.Code, epProxy);
else
m_log.Error("[UDPSERVER]: proxyCircuits already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
m_log.Error("[CLIENT]: proxyCircuits already contains entry for user " + useCircuit.CircuitCode.Code + ". NOT adding.");
}
PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_authenticateSessionsClass, epProxy);
if (!PacketServer.AddNewClient(epSender, useCircuit, m_assetCache, m_circuitManager, epProxy))
m_log.ErrorFormat(
"[CLIENT]: A circuit already existed for agent {0}, circuit {1}",
useCircuit.CircuitCode.ID, useCircuit.CircuitCode.Code);
}
PacketPool.Instance.ReturnPacket(packet);
@ -371,7 +389,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void ServerListener()
{
uint newPort = listenPort;
m_log.Info("[SERVER]: Opening UDP socket on " + listenIP + " " + newPort + ".");
m_log.Info("[UDPSERVER]: Opening UDP socket on " + listenIP + " " + newPort + ".");
ServerIncoming = new IPEndPoint(listenIP, (int)newPort);
m_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@ -385,14 +403,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
listenPort = newPort;
m_log.Info("[SERVER]: UDP socket bound, getting ready to listen");
m_log.Info("[UDPSERVER]: UDP socket bound, getting ready to listen");
ipeSender = new IPEndPoint(listenIP, 0);
epSender = (EndPoint)ipeSender;
ReceivedData = new AsyncCallback(OnReceivedData);
m_socket.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null);
m_log.Info("[SERVER]: Listening on port " + newPort);
m_log.Info("[UDPSERVER]: Listening on port " + newPort);
}
public virtual void RegisterPacketServer(LLPacketServer server)
@ -409,7 +427,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
sendto = (EndPoint)clientCircuits_reverse[circuitcode];
} catch {
// Exceptions here mean there is no circuit
m_log.Warn("Circuit not found, not sending packet");
m_log.Warn("[CLIENT]: Circuit not found, not sending packet");
return;
}
@ -448,7 +466,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else
{
m_log.DebugFormat(
"[UDPSERVER]: endpoint for circuit code {0} in RemoveClientCircuit() was unexpectedly null!", circuitcode);
"[CLIENT]: endpoint for circuit code {0} in RemoveClientCircuit() was unexpectedly null!", circuitcode);
}
}
lock (proxyCircuits)
@ -472,14 +490,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!clientCircuits.ContainsKey(userEP))
clientCircuits.Add(userEP, useCircuit.CircuitCode.Code);
else
m_log.Error("[UDPSERVER]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
m_log.Error("[CLIENT]: clientCircuits already contans entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
}
// This data structure is synchronized, so we don't need the lock
if (!clientCircuits_reverse.ContainsKey(useCircuit.CircuitCode.Code))
clientCircuits_reverse.Add(useCircuit.CircuitCode.Code, userEP);
else
m_log.Error("[UDPSERVER]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
m_log.Error("[CLIENT]: clientCurcuits_reverse already contains entry for user " + useCircuit.CircuitCode.Code.ToString() + ". NOT adding.");
lock (proxyCircuits)
{
@ -495,7 +513,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
}
PacketServer.AddNewClient(userEP, useCircuit, m_assetCache, m_authenticateSessionsClass, proxyEP);
PacketServer.AddNewClient(userEP, useCircuit, m_assetCache, m_circuitManager, proxyEP);
}
}
}

View File

@ -593,7 +593,6 @@ namespace OpenSim.Region.Communications.OGS1
return response;
}
// Grid Request Processing
/// <summary>
/// Received from the user server when a user starts logging in. This call allows
/// the region to prepare for direct communication from the client. Sends back an empty
@ -603,7 +602,6 @@ namespace OpenSim.Region.Communications.OGS1
/// <returns></returns>
public XmlRpcResponse ExpectUser(XmlRpcRequest request)
{
m_log.Debug("[CONNECTION DEBUGGING]: Expect User called, starting agent setup ... ");
Hashtable requestData = (Hashtable) request.Params[0];
AgentCircuitData agentData = new AgentCircuitData();
agentData.SessionID = new UUID((string) requestData["session_id"]);
@ -613,15 +611,20 @@ namespace OpenSim.Region.Communications.OGS1
agentData.AgentID = new UUID((string) requestData["agent_id"]);
agentData.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
agentData.CapsPath = (string) requestData["caps_path"];
ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
m_log.DebugFormat(
"[CLIENT]: Told by user service to prepare for a connection from {0} {1} {2}, circuit {3}",
agentData.firstname, agentData.lastname, agentData.AgentID, agentData.circuitcode);
if (requestData.ContainsKey("child_agent") && requestData["child_agent"].Equals("1"))
{
m_log.Debug("[CONNECTION DEBUGGING]: Child agent detected");
m_log.Debug("[CLIENT]: Child agent detected");
agentData.child = true;
}
else
{
m_log.Debug("[CONNECTION DEBUGGING]: Main agent detected");
m_log.Debug("[CLIENT]: Main agent detected");
agentData.startpos =
new Vector3((float)Convert.ToDecimal((string)requestData["startpos_x"]),
(float)Convert.ToDecimal((string)requestData["startpos_y"]),
@ -629,9 +632,6 @@ namespace OpenSim.Region.Communications.OGS1
agentData.child = false;
}
ulong regionHandle = Convert.ToUInt64((string) requestData["regionhandle"]);
RegionInfo[] regions = m_regionsOnInstance.ToArray();
bool banned = false;
@ -654,7 +654,7 @@ namespace OpenSim.Region.Communications.OGS1
if (banned)
{
m_log.InfoFormat("[OGS1 GRID SERVICES]: Denying access for user {0} {1} because user is banned",agentData.firstname,agentData.lastname);
m_log.InfoFormat("[CLIENT]: Denying access for user {0} {1} because user is banned",agentData.firstname,agentData.lastname);
Hashtable respdata = new Hashtable();
respdata["success"] = "FALSE";
@ -663,14 +663,12 @@ namespace OpenSim.Region.Communications.OGS1
}
else
{
m_log.Debug("[CONNECTION DEBUGGING]: Triggering welcome for " + agentData.AgentID.ToString() + " into " + regionHandle.ToString());
m_localBackend.TriggerExpectUser(regionHandle, agentData);
m_log.Info("[OGS1 GRID SERVICES]: Welcoming new user...");
Hashtable respdata = new Hashtable();
respdata["success"] = "TRUE";
resp.Value = respdata;
}
return resp;
}
// Grid Request Processing

View File

@ -2513,7 +2513,7 @@ namespace OpenSim.Region.Environment.Scenes
#region RegionComms
/// <summary>
///
/// Register the methods that should be invoked when this scene receives various incoming events
/// </summary>
public void RegisterCommsEvents()
{
@ -2549,7 +2549,7 @@ namespace OpenSim.Region.Environment.Scenes
}
/// <summary>
/// Do the work necessary to initiate a new user connection.
/// Do the work necessary to initiate a new user connection for a particular scene.
/// At the moment, this consists of setting up the caps infrastructure
/// </summary>
/// <param name="regionHandle"></param>
@ -2582,10 +2582,6 @@ namespace OpenSim.Region.Environment.Scenes
}
}
m_log.DebugFormat(
"[CONNECTION DEBUGGING]: Creating new circuit code ({0}) for avatar {1} at {2}",
agent.circuitcode, agent.AgentID, RegionInfo.RegionName);
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
// rewrite session_id
CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);