From 78f831ef5220907e4d50422a5422063921062cf8 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Sun, 7 Sep 2008 03:22:33 +0000
Subject: * minor: Clean up of logging messages to make following the client
login process easier * documentation
---
OpenSim/Framework/AgentCircuitManager.cs | 13 +++--
OpenSim/Grid/UserServer/UserLoginService.cs | 1 -
.../Region/ClientStack/LindenUDP/LLClientView.cs | 22 ++++++--
.../Region/ClientStack/LindenUDP/LLPacketServer.cs | 42 +++++++++++---
.../Region/ClientStack/LindenUDP/LLUDPServer.cs | 66 ++++++++++++++--------
.../Region/Communications/OGS1/OGS1GridServices.cs | 22 ++++----
OpenSim/Region/Environment/Scenes/Scene.cs | 8 +--
7 files changed, 113 insertions(+), 61 deletions(-)
diff --git a/OpenSim/Framework/AgentCircuitManager.cs b/OpenSim/Framework/AgentCircuitManager.cs
index 96a7816..027d0c6 100644
--- a/OpenSim/Framework/AgentCircuitManager.cs
+++ b/OpenSim/Framework/AgentCircuitManager.cs
@@ -30,14 +30,13 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
+ ///
+ /// Manage client circuits
+ ///
public class AgentCircuitManager
{
public Dictionary AgentCircuits = new Dictionary();
- public AgentCircuitManager()
- {
- }
-
public virtual AuthenticateResponse AuthenticateSession(UUID sessionID, UUID agentID, uint circuitcode)
{
AgentCircuitData validcircuit = null;
@@ -74,6 +73,11 @@ namespace OpenSim.Framework
return (user);
}
+ ///
+ /// Add information about a new circuit.
+ ///
+ ///
+ ///
public virtual void AddNewCircuit(uint circuitCode, AgentCircuitData agentData)
{
if (AgentCircuits.ContainsKey(circuitCode))
@@ -118,7 +122,6 @@ namespace OpenSim.Framework
///
///
///
-
public bool TryChangeCiruitCode(uint circuitcode, uint newcircuitcode)
{
lock (AgentCircuits)
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 10490a6..06a68ae 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -309,7 +309,6 @@ namespace OpenSim.Grid.UserServer
{
bool responseSuccess = true;
-
if (GridResp.Value != null)
{
Hashtable resp = (Hashtable) GridResp.Value;
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 5e22e2d..b721fa3 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -376,6 +376,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/* METHODS */
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
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
///
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
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
index 07d3c45..c36a238 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs
@@ -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)
+ ///
+ /// Create a new client circuit
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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);
}
+ ///
+ /// Add a new client circuit
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if a new circuit was created, false if a circuit with the given circuit code already existed
+ ///
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);
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index ceb99ae..5625854 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -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;
+
+ ///
+ /// Manages authentication for agent circuits
+ ///
+ 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)
+ ///
+ /// Initialize the server
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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);
}
}
}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a3bcc26..4443de9 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -593,7 +593,6 @@ namespace OpenSim.Region.Communications.OGS1
return response;
}
- // Grid Request Processing
///
/// 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
@@ -602,8 +601,7 @@ namespace OpenSim.Region.Communications.OGS1
///
///
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
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 9e784d6..d8ce3f0 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2513,7 +2513,7 @@ namespace OpenSim.Region.Environment.Scenes
#region RegionComms
///
- ///
+ /// Register the methods that should be invoked when this scene receives various incoming events
///
public void RegisterCommsEvents()
{
@@ -2549,7 +2549,7 @@ namespace OpenSim.Region.Environment.Scenes
}
///
- /// 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
///
///
@@ -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);
--
cgit v1.1