aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2007-05-16 16:01:01 +0000
committerMW2007-05-16 16:01:01 +0000
commitbd6e69b97c0d62eafd65ce6079675ad43a26309e (patch)
treec85d01460b3b46431d8783b62e11686633da90e1
parentMore refactoring. (diff)
downloadopensim-SC-bd6e69b97c0d62eafd65ce6079675ad43a26309e.zip
opensim-SC-bd6e69b97c0d62eafd65ce6079675ad43a26309e.tar.gz
opensim-SC-bd6e69b97c0d62eafd65ce6079675ad43a26309e.tar.bz2
opensim-SC-bd6e69b97c0d62eafd65ce6079675ad43a26309e.tar.xz
Yet more cleanup/refactoring
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/SimClient.PacketHandlers.cs7
-rw-r--r--OpenSim.RegionServer/SimClient.cs52
-rw-r--r--OpenSim.RegionServer/UDPServer.cs2
-rw-r--r--ServiceManager/ServiceManager.csproj33
4 files changed, 61 insertions, 33 deletions
diff --git a/OpenSim.RegionServer/SimClient.PacketHandlers.cs b/OpenSim.RegionServer/SimClient.PacketHandlers.cs
index f4de974..bc49898 100644
--- a/OpenSim.RegionServer/SimClient.PacketHandlers.cs
+++ b/OpenSim.RegionServer/SimClient.PacketHandlers.cs
@@ -20,6 +20,13 @@ namespace OpenSim
20{ 20{
21 public partial class SimClient 21 public partial class SimClient
22 { 22 {
23 protected virtual void RegisterLocalPacketHandlers()
24 {
25 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
26 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
27 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
28 }
29
23 protected virtual bool Logout(SimClient simClient, Packet packet) 30 protected virtual bool Logout(SimClient simClient, Packet packet)
24 { 31 {
25 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ProcessInPacket() - Got a logout request"); 32 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ProcessInPacket() - Got a logout request");
diff --git a/OpenSim.RegionServer/SimClient.cs b/OpenSim.RegionServer/SimClient.cs
index 81da10e..5bd098b 100644
--- a/OpenSim.RegionServer/SimClient.cs
+++ b/OpenSim.RegionServer/SimClient.cs
@@ -109,8 +109,8 @@ namespace OpenSim
109 m_sandboxMode = sandboxMode; 109 m_sandboxMode = sandboxMode;
110 m_child = child; 110 m_child = child;
111 m_regionData = regionDat; 111 m_regionData = regionDat;
112 112
113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs - Started up new client thread to handle incoming request"); 113 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs - Started up new client thread to handle incoming request");
114 cirpack = initialcirpack; 114 cirpack = initialcirpack;
115 userEP = remoteEP; 115 userEP = remoteEP;
116 if (m_gridServer.GetName() == "Remote") 116 if (m_gridServer.GetName() == "Remote")
@@ -135,16 +135,10 @@ namespace OpenSim
135 ClientThread.Start(); 135 ClientThread.Start();
136 } 136 }
137 137
138 protected virtual void RegisterLocalPacketHandlers() 138 # region Client Methods
139 {
140 this.AddLocalPacketHandler(PacketType.LogoutRequest, this.Logout);
141 this.AddLocalPacketHandler(PacketType.AgentCachedTexture, this.AgentTextureCached);
142 this.AddLocalPacketHandler(PacketType.MultipleObjectUpdate, this.MultipleObjUpdate);
143 }
144
145 public void UpgradeClient() 139 public void UpgradeClient()
146 { 140 {
147 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - upgrading child to full agent"); 141 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - upgrading child to full agent");
148 this.m_child = false; 142 this.m_child = false;
149 this.m_world.RemoveViewerAgent(this); 143 this.m_world.RemoveViewerAgent(this);
150 if (!this.m_sandboxMode) 144 if (!this.m_sandboxMode)
@@ -157,7 +151,7 @@ namespace OpenSim
157 151
158 public void DowngradeClient() 152 public void DowngradeClient()
159 { 153 {
160 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"SimClient.cs:UpgradeClient() - changing full agent to child"); 154 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "SimClient.cs:UpgradeClient() - changing full agent to child");
161 this.m_child = true; 155 this.m_child = true;
162 this.m_world.RemoveViewerAgent(this); 156 this.m_world.RemoveViewerAgent(this);
163 this.m_world.AddViewerAgent(this); 157 this.m_world.AddViewerAgent(this);
@@ -188,7 +182,9 @@ namespace OpenSim
188 m_networkServer.RemoveClientCircuit(this.CircuitCode); 182 m_networkServer.RemoveClientCircuit(this.CircuitCode);
189 this.ClientThread.Abort(); 183 this.ClientThread.Abort();
190 } 184 }
185 #endregion
191 186
187 # region Packet Handling
192 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler) 188 public static bool AddPacketHandler(PacketType packetType, PacketMethod handler)
193 { 189 {
194 bool result = false; 190 bool result = false;
@@ -242,6 +238,10 @@ namespace OpenSim
242 return result; 238 return result;
243 } 239 }
244 240
241 # endregion
242
243 # region Low Level Packet Methods
244
245 private void ack_pack(Packet Pack) 245 private void ack_pack(Packet Pack)
246 { 246 {
247 if (Pack.Header.Reliable) 247 if (Pack.Header.Reliable)
@@ -276,7 +276,7 @@ namespace OpenSim
276 { 276 {
277 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent)) 277 if ((now - packet.TickCount > RESEND_TIMEOUT) && (!packet.Header.Resent))
278 { 278 {
279 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Resending " + packet.Type.ToString() + " packet, " + 279 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Resending " + packet.Type.ToString() + " packet, " +
280 (now - packet.TickCount) + "ms have passed"); 280 (now - packet.TickCount) + "ms have passed");
281 281
282 packet.Header.Resent = true; 282 packet.Header.Resent = true;
@@ -295,7 +295,7 @@ namespace OpenSim
295 if (PendingAcks.Count > 250) 295 if (PendingAcks.Count > 250)
296 { 296 {
297 // FIXME: Handle the odd case where we have too many pending ACKs queued up 297 // FIXME: Handle the odd case where we have too many pending ACKs queued up
298 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE,"Too many ACKs queued up!"); 298 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.VERBOSE, "Too many ACKs queued up!");
299 return; 299 return;
300 } 300 }
301 301
@@ -327,6 +327,10 @@ namespace OpenSim
327 ResendUnacked(); 327 ResendUnacked();
328 } 328 }
329 329
330 # endregion
331
332 #region Packet Queue Processing
333
330 protected virtual void ProcessOutPacket(Packet Pack) 334 protected virtual void ProcessOutPacket(Packet Pack)
331 { 335 {
332 // Keep track of when this packet was sent out 336 // Keep track of when this packet was sent out
@@ -417,7 +421,7 @@ namespace OpenSim
417 } 421 }
418 catch (Exception) 422 catch (Exception)
419 { 423 {
420 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread"); 424 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "OpenSimClient.cs:ProcessOutPacket() - WARNING: Socket exception occurred on connection " + userEP.ToString() + " - killing thread");
421 ClientThread.Abort(); 425 ClientThread.Abort();
422 } 426 }
423 427
@@ -478,7 +482,7 @@ namespace OpenSim
478 482
479 protected virtual void ClientLoop() 483 protected virtual void ClientLoop()
480 { 484 {
481 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:ClientLoop() - Entered loop"); 485 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:ClientLoop() - Entered loop");
482 while (true) 486 while (true)
483 { 487 {
484 QueItem nextPacket = PacketQueue.Dequeue(); 488 QueItem nextPacket = PacketQueue.Dequeue();
@@ -495,9 +499,13 @@ namespace OpenSim
495 } 499 }
496 } 500 }
497 501
502 #endregion
503
504 # region Setup
505
498 protected virtual void InitNewClient() 506 protected virtual void InitNewClient()
499 { 507 {
500 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"OpenSimClient.cs:InitNewClient() - Adding viewer agent to world"); 508 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "OpenSimClient.cs:InitNewClient() - Adding viewer agent to world");
501 509
502 m_world.AddViewerAgent(this); 510 m_world.AddViewerAgent(this);
503 world.Entity tempent = m_world.Entities[this.AgentID]; 511 world.Entity tempent = m_world.Entities[this.AgentID];
@@ -507,17 +515,17 @@ namespace OpenSim
507 515
508 protected virtual void AuthUser() 516 protected virtual void AuthUser()
509 { 517 {
510 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 518 // AuthenticateResponse sessionInfo = m_gridServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
511 AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code); 519 AuthenticateResponse sessionInfo = this.m_networkServer.AuthenticateSession(cirpack.CircuitCode.SessionID, cirpack.CircuitCode.ID, cirpack.CircuitCode.Code);
512 if (!sessionInfo.Authorised) 520 if (!sessionInfo.Authorised)
513 { 521 {
514 //session/circuit not authorised 522 //session/circuit not authorised
515 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString()); 523 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "OpenSimClient.cs:AuthUser() - New user request denied to " + userEP.ToString());
516 ClientThread.Abort(); 524 ClientThread.Abort();
517 } 525 }
518 else 526 else
519 { 527 {
520 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString()); 528 OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "OpenSimClient.cs:AuthUser() - Got authenticated connection from " + userEP.ToString());
521 //session is authorised 529 //session is authorised
522 this.AgentID = cirpack.CircuitCode.ID; 530 this.AgentID = cirpack.CircuitCode.ID;
523 this.SessionID = cirpack.CircuitCode.SessionID; 531 this.SessionID = cirpack.CircuitCode.SessionID;
@@ -539,9 +547,10 @@ namespace OpenSim
539 ClientLoop(); 547 ClientLoop();
540 } 548 }
541 } 549 }
550 # endregion
542 551
543 #region Inventory Creation 552 #region Inventory Creation
544 private void SetupInventory(AuthenticateResponse sessionInfo) 553 private void SetupInventory(AuthenticateResponse sessionInfo)
545 { 554 {
546 AgentInventory inventory = null; 555 AgentInventory inventory = null;
547 if (sessionInfo.LoginInfo.InventoryFolder != null) 556 if (sessionInfo.LoginInfo.InventoryFolder != null)
@@ -630,6 +639,8 @@ namespace OpenSim
630 } 639 }
631 #endregion 640 #endregion
632 641
642 #region Nested Classes
643
633 public class QueItem 644 public class QueItem
634 { 645 {
635 public QueItem() 646 public QueItem()
@@ -639,5 +650,6 @@ namespace OpenSim
639 public Packet Packet; 650 public Packet Packet;
640 public bool Incoming; 651 public bool Incoming;
641 } 652 }
653 #endregion
642 } 654 }
643} 655}
diff --git a/OpenSim.RegionServer/UDPServer.cs b/OpenSim.RegionServer/UDPServer.cs
index 12f35ab..0fd3cdb 100644
--- a/OpenSim.RegionServer/UDPServer.cs
+++ b/OpenSim.RegionServer/UDPServer.cs
@@ -81,6 +81,8 @@ namespace OpenSim
81 this.user_accounts = accounts; 81 this.user_accounts = accounts;
82 this.m_console = console; 82 this.m_console = console;
83 PacketServer packetServer = new PacketServer(this); 83 PacketServer packetServer = new PacketServer(this);
84
85 //set up delegate for authenticate sessions
84 this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_gridServers.GridServer.AuthenticateSession); 86 this.AuthenticateHandler = new AuthenticateSessionHandler(this.m_gridServers.GridServer.AuthenticateSession);
85 } 87 }
86 88
diff --git a/ServiceManager/ServiceManager.csproj b/ServiceManager/ServiceManager.csproj
index f703ef1..ac118c3 100644
--- a/ServiceManager/ServiceManager.csproj
+++ b/ServiceManager/ServiceManager.csproj
@@ -1,4 +1,4 @@
1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 1<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2 <PropertyGroup> 2 <PropertyGroup>
3 <ProjectType>Local</ProjectType> 3 <ProjectType>Local</ProjectType>
4 <ProductVersion>8.0.50727</ProductVersion> 4 <ProductVersion>8.0.50727</ProductVersion>
@@ -6,7 +6,8 @@
6 <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid> 6 <ProjectGuid>{E141F4EE-0000-0000-0000-000000000000}</ProjectGuid>
7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 7 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 8 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
9 <ApplicationIcon></ApplicationIcon> 9 <ApplicationIcon>
10 </ApplicationIcon>
10 <AssemblyKeyContainerName> 11 <AssemblyKeyContainerName>
11 </AssemblyKeyContainerName> 12 </AssemblyKeyContainerName>
12 <AssemblyName>ServiceManager</AssemblyName> 13 <AssemblyName>ServiceManager</AssemblyName>
@@ -15,9 +16,11 @@
15 <DefaultTargetSchema>IE50</DefaultTargetSchema> 16 <DefaultTargetSchema>IE50</DefaultTargetSchema>
16 <DelaySign>false</DelaySign> 17 <DelaySign>false</DelaySign>
17 <OutputType>Exe</OutputType> 18 <OutputType>Exe</OutputType>
18 <AppDesignerFolder></AppDesignerFolder> 19 <AppDesignerFolder>
20 </AppDesignerFolder>
19 <RootNamespace>ServiceManager</RootNamespace> 21 <RootNamespace>ServiceManager</RootNamespace>
20 <StartupObject></StartupObject> 22 <StartupObject>
23 </StartupObject>
21 <FileUpgradeFlags> 24 <FileUpgradeFlags>
22 </FileUpgradeFlags> 25 </FileUpgradeFlags>
23 </PropertyGroup> 26 </PropertyGroup>
@@ -28,7 +31,8 @@
28 <ConfigurationOverrideFile> 31 <ConfigurationOverrideFile>
29 </ConfigurationOverrideFile> 32 </ConfigurationOverrideFile>
30 <DefineConstants>TRACE;DEBUG</DefineConstants> 33 <DefineConstants>TRACE;DEBUG</DefineConstants>
31 <DocumentationFile></DocumentationFile> 34 <DocumentationFile>
35 </DocumentationFile>
32 <DebugSymbols>True</DebugSymbols> 36 <DebugSymbols>True</DebugSymbols>
33 <FileAlignment>4096</FileAlignment> 37 <FileAlignment>4096</FileAlignment>
34 <Optimize>False</Optimize> 38 <Optimize>False</Optimize>
@@ -37,7 +41,8 @@
37 <RemoveIntegerChecks>False</RemoveIntegerChecks> 41 <RemoveIntegerChecks>False</RemoveIntegerChecks>
38 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 42 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
39 <WarningLevel>4</WarningLevel> 43 <WarningLevel>4</WarningLevel>
40 <NoWarn></NoWarn> 44 <NoWarn>
45 </NoWarn>
41 </PropertyGroup> 46 </PropertyGroup>
42 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 47 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
43 <AllowUnsafeBlocks>False</AllowUnsafeBlocks> 48 <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@@ -46,7 +51,8 @@
46 <ConfigurationOverrideFile> 51 <ConfigurationOverrideFile>
47 </ConfigurationOverrideFile> 52 </ConfigurationOverrideFile>
48 <DefineConstants>TRACE</DefineConstants> 53 <DefineConstants>TRACE</DefineConstants>
49 <DocumentationFile></DocumentationFile> 54 <DocumentationFile>
55 </DocumentationFile>
50 <DebugSymbols>False</DebugSymbols> 56 <DebugSymbols>False</DebugSymbols>
51 <FileAlignment>4096</FileAlignment> 57 <FileAlignment>4096</FileAlignment>
52 <Optimize>True</Optimize> 58 <Optimize>True</Optimize>
@@ -55,18 +61,19 @@
55 <RemoveIntegerChecks>False</RemoveIntegerChecks> 61 <RemoveIntegerChecks>False</RemoveIntegerChecks>
56 <TreatWarningsAsErrors>False</TreatWarningsAsErrors> 62 <TreatWarningsAsErrors>False</TreatWarningsAsErrors>
57 <WarningLevel>4</WarningLevel> 63 <WarningLevel>4</WarningLevel>
58 <NoWarn></NoWarn> 64 <NoWarn>
65 </NoWarn>
59 </PropertyGroup> 66 </PropertyGroup>
60 <ItemGroup> 67 <ItemGroup>
61 <Reference Include="System" > 68 <Reference Include="System">
62 <HintPath>System.dll</HintPath> 69 <HintPath>System.dll</HintPath>
63 <Private>False</Private> 70 <Private>False</Private>
64 </Reference> 71 </Reference>
65 <Reference Include="System.ServiceProcess" > 72 <Reference Include="System.ServiceProcess">
66 <HintPath>System.ServiceProcess.dll</HintPath> 73 <HintPath>System.ServiceProcess.dll</HintPath>
67 <Private>False</Private> 74 <Private>False</Private>
68 </Reference> 75 </Reference>
69 <Reference Include="System.Xml" > 76 <Reference Include="System.Xml">
70 <HintPath>System.Xml.dll</HintPath> 77 <HintPath>System.Xml.dll</HintPath>
71 <Private>False</Private> 78 <Private>False</Private>
72 </Reference> 79 </Reference>
@@ -75,7 +82,7 @@
75 </ItemGroup> 82 </ItemGroup>
76 <ItemGroup> 83 <ItemGroup>
77 <Compile Include="ServiceManager.cs"> 84 <Compile Include="ServiceManager.cs">
78 <SubType>Code</SubType> 85 <SubType>Component</SubType>
79 </Compile> 86 </Compile>
80 </ItemGroup> 87 </ItemGroup>
81 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> 88 <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
@@ -85,4 +92,4 @@
85 <PostBuildEvent> 92 <PostBuildEvent>
86 </PostBuildEvent> 93 </PostBuildEvent>
87 </PropertyGroup> 94 </PropertyGroup>
88</Project> 95</Project> \ No newline at end of file