diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index cb60028a53..0d44abdf4a 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -527,6 +527,9 @@ namespace OpenSim.Framework /// string Name { get; } + /// + /// Determines whether the client thread is doing anything or not. + /// bool IsActive { get; set; } bool SendLogoutPacketWhenClosing { set; } @@ -749,6 +752,23 @@ namespace OpenSim.Framework event UserInfoRequest OnUserInfoRequest; event UpdateUserInfo OnUpdateUserInfo; + + /// + /// Set the debug level at which packet output should be printed to console. + /// + void SetDebugPacketLevel(int newDebug); + + void InPacket(object NewPack); + void ProcessInPacket(Packet NewPack); + void Close(bool ShutdownCircuit); + void Kick(string message); + + /// + /// Start processing for this client. + /// + void Start(); + + void Stop(); // void ActivateGesture(UUID assetId, UUID gestureId); @@ -1034,16 +1054,6 @@ namespace OpenSim.Framework byte[] GetThrottlesPacked(float multiplier); - /// - /// Set the debug level at which packet output should be printed to console. - /// - void SetDebugPacketLevel(int newDebug); - - void InPacket(object NewPack); - void ProcessInPacket(Packet NewPack); - void Close(bool ShutdownCircuit); - void Kick(string message); - void Stop(); event ViewerEffectEventHandler OnViewerEffect; event Action OnLogout; event Action OnConnectionClosed; diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 3243c2f684..ebbecb79fc 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -471,12 +471,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_PacketHandler.OnPacketStats += PopulateStats; RegisterLocalPacketHandlers(); - - m_clientThread = new Thread(Start); - m_clientThread.Name = "ClientThread"; - m_clientThread.IsBackground = true; - m_clientThread.Start(); - ThreadTracker.Add(m_clientThread); } public void SetDebugPacketLevel(int newDebugPacketLevel) @@ -813,11 +807,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP RefreshGroupMembership(); } - /// - /// Start a user session. This method lies at the base of the entire client thread. - /// - protected virtual void Start() + public virtual void Start() { + m_clientThread = new Thread(RunUserSession); + m_clientThread.Name = "ClientThread"; + m_clientThread.IsBackground = true; + m_clientThread.Start(); + ThreadTracker.Add(m_clientThread); + } + + /// + /// Run a user session. This method lies at the base of the entire client thread. + /// + protected virtual void RunUserSession() + { //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(); diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs index 9f8383c24d..2b52220411 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLPacketServer.cs @@ -160,6 +160,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP newuser.OnViewerEffect += m_scene.ClientManager.ViewerEffectHandler; newuser.OnLogout += LogoutHandler; newuser.OnConnectionClosed += CloseClient; + + newuser.Start(); return true; } diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index d06f35ac6e..f0d5de27a0 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -812,6 +812,10 @@ namespace OpenSim.Region.Environment.Modules.World.NPC { } + public void Start() + { + } + public void Stop() { } diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 5a7d42cd4a..3710f2c73a 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -800,6 +800,10 @@ namespace OpenSim.Region.Examples.SimpleModule { } + public void Start() + { + } + public void Stop() { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 41c2eb664d..a9ee837291 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -757,6 +757,10 @@ namespace OpenSim.Tests.Common.Mock { } + public void Start() + { + } + public void Stop() { }