Yet more cleanup/refactoring
parent
3f39648605
commit
bd6e69b97c
|
@ -20,6 +20,13 @@ namespace OpenSim
|
|||
{
|
||||
public partial class SimClient
|
||||
{
|
||||
protected virtual void RegisterLocalPacketHandlers()
|
||||
{
|
||||
this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
|
||||
this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
|
||||
this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
|
||||
}
|
||||
|
||||
protected virtual bool Logout(SimClient simClient, Packet packet)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ProcessInPacket() - Got a logout request");
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace OpenSim
|
|||
m_child = child;
|
||||
m_regionData = regionDat;
|
||||
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs - Started up new client thread to handle incoming request");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request");
|
||||
cirpack = initialcirpack;
|
||||
userEP = remoteEP;
|
||||
if (m_gridServer.GetName() == "Remote")
|
||||
|
@ -135,16 +135,10 @@ namespace OpenSim
|
|||
ClientThread.Start();
|
||||
}
|
||||
|
||||
protected virtual void RegisterLocalPacketHandlers()
|
||||
{
|
||||
this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
|
||||
this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
|
||||
this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
|
||||
}
|
||||
|
||||
# region Client Methods
|
||||
public void UpgradeClient()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
|
||||
this.m_child = false;
|
||||
this.m_world.RemoveViewerAgent(this);
|
||||
if (!this.m_sandboxMode)
|
||||
|
@ -157,7 +151,7 @@ namespace OpenSim
|
|||
|
||||
public void DowngradeClient()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - changing full agent to child");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
|
||||
this.m_child = true;
|
||||
this.m_world.RemoveViewerAgent(this);
|
||||
this.m_world.AddViewerAgent(this);
|
||||
|
@ -188,7 +182,9 @@ namespace OpenSim
|
|||
m_networkServer.RemoveClientCircuit(this.CircuitCode);
|
||||
this.ClientThread.Abort();
|
||||
}
|
||||
#endregion
|
||||
|
||||
# region Packet Handling
|
||||
public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
|
||||
{
|
||||
bool result = false;
|
||||
|
@ -242,6 +238,10 @@ namespace OpenSim
|
|||
return result;
|
||||
}
|
||||
|
||||
# endregion
|
||||
|
||||
# region Low Level Packet Methods
|
||||
|
||||
private void ack_pack(Packet Pack)
|
||||
{
|
||||
if (Pack.Header.Reliable)
|
||||
|
@ -276,7 +276,7 @@ namespace OpenSim
|
|||
{
|
||||
if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Resending " + packet.Type.ToString() + " packet, " +
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Resending " + packet.Type.ToString() + " packet, " +
|
||||
(now - packet.TickCount) + "ms have passed");
|
||||
|
||||
packet.Header.Resent = true;
|
||||
|
@ -295,7 +295,7 @@ namespace OpenSim
|
|||
if (PendingAcks.Count > 250)
|
||||
{
|
||||
// FIXME: Handle the odd case where we have too many pending ACKs queued up
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Too many ACKs queued up!");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Too many ACKs queued up!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -327,6 +327,10 @@ namespace OpenSim
|
|||
ResendUnacked();
|
||||
}
|
||||
|
||||
# endregion
|
||||
|
||||
#region Packet Queue Processing
|
||||
|
||||
protected virtual void ProcessOutPacket(Packet Pack)
|
||||
{
|
||||
// Keep track of when this packet was sent out
|
||||
|
@ -417,7 +421,7 @@ namespace OpenSim
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
|
||||
ClientThread.Abort();
|
||||
}
|
||||
|
||||
|
@ -478,7 +482,7 @@ namespace OpenSim
|
|||
|
||||
protected virtual void ClientLoop()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:ClientLoop() - Entered loop");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ClientLoop() - Entered loop");
|
||||
while (true)
|
||||
{
|
||||
QueItem nextPacket = PacketQueue.Dequeue();
|
||||
|
@ -495,9 +499,13 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
# region Setup
|
||||
|
||||
protected virtual void InitNewClient()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
|
||||
|
||||
m_world.AddViewerAgent(this);
|
||||
world.Entity tempent = m_world.Entities[this.AgentID];
|
||||
|
@ -507,17 +515,17 @@ namespace OpenSim
|
|||
|
||||
protected virtual void AuthUser()
|
||||
{
|
||||
// AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||
// AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||
AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
|
||||
if (!sessionInfo.Authorised)
|
||||
{
|
||||
//session/circuit not authorised
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
|
||||
ClientThread.Abort();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
|
||||
//session is authorised
|
||||
this.AgentID = cirpack.CircuitCode.ID;
|
||||
this.SessionID = cirpack.CircuitCode.SessionID;
|
||||
|
@ -539,9 +547,10 @@ namespace OpenSim
|
|||
ClientLoop();
|
||||
}
|
||||
}
|
||||
# endregion
|
||||
|
||||
#region Inventory Creation
|
||||
private void SetupInventory(AuthenticateResponse sessionInfo)
|
||||
private void SetupInventory(AuthenticateResponse sessionInfo)
|
||||
{
|
||||
AgentInventory inventory = null;
|
||||
if (sessionInfo.LoginInfo.InventoryFolder != null)
|
||||
|
@ -630,6 +639,8 @@ namespace OpenSim
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region Nested Classes
|
||||
|
||||
public class QueItem
|
||||
{
|
||||
public QueItem()
|
||||
|
@ -639,5 +650,6 @@ namespace OpenSim
|
|||
public Packet Packet;
|
||||
public bool Incoming;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,8 @@ namespace OpenSim
|
|||
this.user_accounts = accounts;
|
||||
this.m_console = console;
|
||||
PacketServer packetServer = new PacketServer(this);
|
||||
|
||||
//set up delegate for authenticate sessions
|
||||
this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_gridServers.GridServer.AuthenticateSession);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
|
@ -6,7 +6,8 @@
|
|||
<ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>ServiceManager</AssemblyName>
|
||||
|
@ -15,9 +16,11 @@
|
|||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<AppDesignerFolder>
|
||||
</AppDesignerFolder>
|
||||
<RootNamespace>ServiceManager</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
|
@ -28,7 +31,8 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
|
@ -37,7 +41,8 @@
|
|||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
|
@ -46,7 +51,8 @@
|
|||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
|
@ -55,18 +61,19 @@
|
|||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" >
|
||||
<Reference Include="System">
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.ServiceProcess" >
|
||||
<Reference Include="System.ServiceProcess">
|
||||
<HintPath>System.ServiceProcess.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<Reference Include="System.Xml">
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
|
@ -75,7 +82,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ServiceManager.cs">
|
||||
<SubType>Code</SubType>
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
|
|
Loading…
Reference in New Issue