diff options
author | MW | 2007-05-16 12:44:58 +0000 |
---|---|---|
committer | MW | 2007-05-16 12:44:58 +0000 |
commit | 3d93d390485075345442b9b5ea35eed88a9cab49 (patch) | |
tree | a51cdb72cd310ae3f579650886836ddc0211d986 /OpenSim.RegionServer | |
parent | made QueItem a nested class in SimClient. (diff) | |
download | opensim-SC-3d93d390485075345442b9b5ea35eed88a9cab49.zip opensim-SC-3d93d390485075345442b9b5ea35eed88a9cab49.tar.gz opensim-SC-3d93d390485075345442b9b5ea35eed88a9cab49.tar.bz2 opensim-SC-3d93d390485075345442b9b5ea35eed88a9cab49.tar.xz |
started to refactor startup code and to move udp server code out to its own class (currently not being used though) so that a single instance can handle multiple regions (each will need to be listening on a separate udp port)
Diffstat (limited to 'OpenSim.RegionServer')
15 files changed, 449 insertions, 249 deletions
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.csproj b/OpenSim.RegionServer/OpenSim.RegionServer.csproj index 9bffb2a..366bd7a 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.csproj +++ b/OpenSim.RegionServer/OpenSim.RegionServer.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>{632E1BFD-0000-0000-0000-000000000000}</ProjectGuid> | 6 | <ProjectGuid>{632E1BFD-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>OpenSim.RegionServer</AssemblyName> | 13 | <AssemblyName>OpenSim.RegionServer</AssemblyName> |
@@ -15,9 +16,11 @@ | |||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | 16 | <DefaultTargetSchema>IE50</DefaultTargetSchema> |
16 | <DelaySign>false</DelaySign> | 17 | <DelaySign>false</DelaySign> |
17 | <OutputType>Library</OutputType> | 18 | <OutputType>Library</OutputType> |
18 | <AppDesignerFolder></AppDesignerFolder> | 19 | <AppDesignerFolder> |
20 | </AppDesignerFolder> | ||
19 | <RootNamespace>OpenSim.RegionServer</RootNamespace> | 21 | <RootNamespace>OpenSim.RegionServer</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,26 +61,28 @@ | |||
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.Xml" > | 72 | <Reference Include="System.Data" /> |
73 | <Reference Include="System.Xml"> | ||
66 | <HintPath>System.Xml.dll</HintPath> | 74 | <HintPath>System.Xml.dll</HintPath> |
67 | <Private>False</Private> | 75 | <Private>False</Private> |
68 | </Reference> | 76 | </Reference> |
69 | <Reference Include="libsecondlife.dll" > | 77 | <Reference Include="libsecondlife.dll"> |
70 | <HintPath>..\bin\libsecondlife.dll</HintPath> | 78 | <HintPath>..\bin\libsecondlife.dll</HintPath> |
71 | <Private>False</Private> | 79 | <Private>False</Private> |
72 | </Reference> | 80 | </Reference> |
73 | <Reference Include="Axiom.MathLib.dll" > | 81 | <Reference Include="Axiom.MathLib.dll"> |
74 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> | 82 | <HintPath>..\bin\Axiom.MathLib.dll</HintPath> |
75 | <Private>False</Private> | 83 | <Private>False</Private> |
76 | </Reference> | 84 | </Reference> |
77 | <Reference Include="Db4objects.Db4o.dll" > | 85 | <Reference Include="Db4objects.Db4o.dll"> |
78 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> | 86 | <HintPath>..\bin\Db4objects.Db4o.dll</HintPath> |
79 | <Private>False</Private> | 87 | <Private>False</Private> |
80 | </Reference> | 88 | </Reference> |
@@ -84,43 +92,43 @@ | |||
84 | <Name>OpenSim.Terrain.BasicTerrain</Name> | 92 | <Name>OpenSim.Terrain.BasicTerrain</Name> |
85 | <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> | 93 | <Project>{2270B8FE-0000-0000-0000-000000000000}</Project> |
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 94 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
87 | <Private>False</Private> | 95 | <Private>False</Private> |
88 | </ProjectReference> | 96 | </ProjectReference> |
89 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> | 97 | <ProjectReference Include="..\OpenSim.Framework\OpenSim.Framework.csproj"> |
90 | <Name>OpenSim.Framework</Name> | 98 | <Name>OpenSim.Framework</Name> |
91 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> | 99 | <Project>{8ACA2445-0000-0000-0000-000000000000}</Project> |
92 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 100 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
93 | <Private>False</Private> | 101 | <Private>False</Private> |
94 | </ProjectReference> | 102 | </ProjectReference> |
95 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> | 103 | <ProjectReference Include="..\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj"> |
96 | <Name>OpenSim.Framework.Console</Name> | 104 | <Name>OpenSim.Framework.Console</Name> |
97 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> | 105 | <Project>{A7CD0630-0000-0000-0000-000000000000}</Project> |
98 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 106 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
99 | <Private>False</Private> | 107 | <Private>False</Private> |
100 | </ProjectReference> | 108 | </ProjectReference> |
101 | <ProjectReference Include="..\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> | 109 | <ProjectReference Include="..\OpenSim.GenericConfig\Xml\OpenSim.GenericConfig.Xml.csproj"> |
102 | <Name>OpenSim.GenericConfig.Xml</Name> | 110 | <Name>OpenSim.GenericConfig.Xml</Name> |
103 | <Project>{E88EF749-0000-0000-0000-000000000000}</Project> | 111 | <Project>{E88EF749-0000-0000-0000-000000000000}</Project> |
104 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 112 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
105 | <Private>False</Private> | 113 | <Private>False</Private> |
106 | </ProjectReference> | 114 | </ProjectReference> |
107 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> | 115 | <ProjectReference Include="..\OpenSim.Physics\Manager\OpenSim.Physics.Manager.csproj"> |
108 | <Name>OpenSim.Physics.Manager</Name> | 116 | <Name>OpenSim.Physics.Manager</Name> |
109 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> | 117 | <Project>{8BE16150-0000-0000-0000-000000000000}</Project> |
110 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 118 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
111 | <Private>False</Private> | 119 | <Private>False</Private> |
112 | </ProjectReference> | 120 | </ProjectReference> |
113 | <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj"> | 121 | <ProjectReference Include="..\OpenSim.Servers\OpenSim.Servers.csproj"> |
114 | <Name>OpenSim.Servers</Name> | 122 | <Name>OpenSim.Servers</Name> |
115 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> | 123 | <Project>{8BB20F0A-0000-0000-0000-000000000000}</Project> |
116 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 124 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
117 | <Private>False</Private> | 125 | <Private>False</Private> |
118 | </ProjectReference> | 126 | </ProjectReference> |
119 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> | 127 | <ProjectReference Include="..\XmlRpcCS\XMLRPC.csproj"> |
120 | <Name>XMLRPC</Name> | 128 | <Name>XMLRPC</Name> |
121 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> | 129 | <Project>{8E81D43C-0000-0000-0000-000000000000}</Project> |
122 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | 130 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> |
123 | <Private>False</Private> | 131 | <Private>False</Private> |
124 | </ProjectReference> | 132 | </ProjectReference> |
125 | </ItemGroup> | 133 | </ItemGroup> |
126 | <ItemGroup> | 134 | <ItemGroup> |
@@ -139,21 +147,23 @@ | |||
139 | <Compile Include="PacketServer.cs"> | 147 | <Compile Include="PacketServer.cs"> |
140 | <SubType>Code</SubType> | 148 | <SubType>Code</SubType> |
141 | </Compile> | 149 | </Compile> |
142 | <Compile Include="QueItem.cs"> | ||
143 | <SubType>Code</SubType> | ||
144 | </Compile> | ||
145 | <Compile Include="RegionInfo.cs"> | 150 | <Compile Include="RegionInfo.cs"> |
146 | <SubType>Code</SubType> | 151 | <SubType>Code</SubType> |
147 | </Compile> | 152 | </Compile> |
148 | <Compile Include="SimClient(Grid).cs"> | 153 | <Compile Include="RegionInfoBase.cs" /> |
154 | <Compile Include="SimClient.cs"> | ||
149 | <SubType>Code</SubType> | 155 | <SubType>Code</SubType> |
150 | </Compile> | 156 | </Compile> |
151 | <Compile Include="SimClient.cs"> | 157 | <Compile Include="SimClient.Grid.cs"> |
152 | <SubType>Code</SubType> | 158 | <SubType>Code</SubType> |
159 | <DependentUpon>SimClient.cs</DependentUpon> | ||
153 | </Compile> | 160 | </Compile> |
154 | <Compile Include="SimClientPacketHandlers.cs"> | 161 | <Compile Include="SimClient.PacketHandlers.cs"> |
155 | <SubType>Code</SubType> | 162 | <SubType>Code</SubType> |
163 | <DependentUpon>SimClient.cs</DependentUpon> | ||
156 | </Compile> | 164 | </Compile> |
165 | <Compile Include="SimClientBase.cs" /> | ||
166 | <Compile Include="UDPServer.cs" /> | ||
157 | <Compile Include="VersionInfo.cs"> | 167 | <Compile Include="VersionInfo.cs"> |
158 | <SubType>Code</SubType> | 168 | <SubType>Code</SubType> |
159 | </Compile> | 169 | </Compile> |
@@ -172,16 +182,18 @@ | |||
172 | <Compile Include="types\Triangle.cs"> | 182 | <Compile Include="types\Triangle.cs"> |
173 | <SubType>Code</SubType> | 183 | <SubType>Code</SubType> |
174 | </Compile> | 184 | </Compile> |
175 | <Compile Include="world\Avatar.cs"> | 185 | <Compile Include="world\Avatar.Client.cs"> |
176 | <SubType>Code</SubType> | 186 | <SubType>Code</SubType> |
187 | <DependentUpon>Avatar.cs</DependentUpon> | ||
177 | </Compile> | 188 | </Compile> |
178 | <Compile Include="world\AvatarAnimations.cs"> | 189 | <Compile Include="world\Avatar.cs"> |
179 | <SubType>Code</SubType> | 190 | <SubType>Code</SubType> |
180 | </Compile> | 191 | </Compile> |
181 | <Compile Include="world\AvatarClient.cs"> | 192 | <Compile Include="world\Avatar.Update.cs"> |
182 | <SubType>Code</SubType> | 193 | <SubType>Code</SubType> |
194 | <DependentUpon>Avatar.cs</DependentUpon> | ||
183 | </Compile> | 195 | </Compile> |
184 | <Compile Include="world\AvatarUpdate.cs"> | 196 | <Compile Include="world\AvatarAnimations.cs"> |
185 | <SubType>Code</SubType> | 197 | <SubType>Code</SubType> |
186 | </Compile> | 198 | </Compile> |
187 | <Compile Include="world\Entity.cs"> | 199 | <Compile Include="world\Entity.cs"> |
@@ -199,11 +211,13 @@ | |||
199 | <Compile Include="world\World.cs"> | 211 | <Compile Include="world\World.cs"> |
200 | <SubType>Code</SubType> | 212 | <SubType>Code</SubType> |
201 | </Compile> | 213 | </Compile> |
202 | <Compile Include="world\WorldPacketHandlers.cs"> | 214 | <Compile Include="world\World.PacketHandlers.cs"> |
203 | <SubType>Code</SubType> | 215 | <SubType>Code</SubType> |
216 | <DependentUpon>World.cs</DependentUpon> | ||
204 | </Compile> | 217 | </Compile> |
205 | <Compile Include="world\WorldScripting.cs"> | 218 | <Compile Include="world\World.Scripting.cs"> |
206 | <SubType>Code</SubType> | 219 | <SubType>Code</SubType> |
220 | <DependentUpon>World.cs</DependentUpon> | ||
207 | </Compile> | 221 | </Compile> |
208 | <Compile Include="world\scripting\IScriptContext.cs"> | 222 | <Compile Include="world\scripting\IScriptContext.cs"> |
209 | <SubType>Code</SubType> | 223 | <SubType>Code</SubType> |
@@ -231,4 +245,4 @@ | |||
231 | <PostBuildEvent> | 245 | <PostBuildEvent> |
232 | </PostBuildEvent> | 246 | </PostBuildEvent> |
233 | </PropertyGroup> | 247 | </PropertyGroup> |
234 | </Project> | 248 | </Project> \ No newline at end of file |
diff --git a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build index bb7f9ab..ab21d7e 100644 --- a/OpenSim.RegionServer/OpenSim.RegionServer.dll.build +++ b/OpenSim.RegionServer/OpenSim.RegionServer.dll.build | |||
@@ -16,28 +16,30 @@ | |||
16 | <include name="OpenSimMain.cs" /> | 16 | <include name="OpenSimMain.cs" /> |
17 | <include name="OpenSimNetworkHandler.cs" /> | 17 | <include name="OpenSimNetworkHandler.cs" /> |
18 | <include name="PacketServer.cs" /> | 18 | <include name="PacketServer.cs" /> |
19 | <include name="QueItem.cs" /> | ||
20 | <include name="RegionInfo.cs" /> | 19 | <include name="RegionInfo.cs" /> |
21 | <include name="SimClient(Grid).cs" /> | 20 | <include name="RegionInfoBase.cs" /> |
22 | <include name="SimClient.cs" /> | 21 | <include name="SimClient.cs" /> |
23 | <include name="SimClientPacketHandlers.cs" /> | 22 | <include name="SimClient.Grid.cs" /> |
23 | <include name="SimClient.PacketHandlers.cs" /> | ||
24 | <include name="SimClientBase.cs" /> | ||
25 | <include name="UDPServer.cs" /> | ||
24 | <include name="VersionInfo.cs" /> | 26 | <include name="VersionInfo.cs" /> |
25 | <include name="Assets/AssetCache.cs" /> | 27 | <include name="Assets/AssetCache.cs" /> |
26 | <include name="Assets/InventoryCache.cs" /> | 28 | <include name="Assets/InventoryCache.cs" /> |
27 | <include name="CAPS/AdminWebFront.cs" /> | 29 | <include name="CAPS/AdminWebFront.cs" /> |
28 | <include name="types/Mesh.cs" /> | 30 | <include name="types/Mesh.cs" /> |
29 | <include name="types/Triangle.cs" /> | 31 | <include name="types/Triangle.cs" /> |
32 | <include name="world/Avatar.Client.cs" /> | ||
30 | <include name="world/Avatar.cs" /> | 33 | <include name="world/Avatar.cs" /> |
34 | <include name="world/Avatar.Update.cs" /> | ||
31 | <include name="world/AvatarAnimations.cs" /> | 35 | <include name="world/AvatarAnimations.cs" /> |
32 | <include name="world/AvatarClient.cs" /> | ||
33 | <include name="world/AvatarUpdate.cs" /> | ||
34 | <include name="world/Entity.cs" /> | 36 | <include name="world/Entity.cs" /> |
35 | <include name="world/Primitive.cs" /> | 37 | <include name="world/Primitive.cs" /> |
36 | <include name="world/Primitive2.cs" /> | 38 | <include name="world/Primitive2.cs" /> |
37 | <include name="world/SceneObject.cs" /> | 39 | <include name="world/SceneObject.cs" /> |
38 | <include name="world/World.cs" /> | 40 | <include name="world/World.cs" /> |
39 | <include name="world/WorldPacketHandlers.cs" /> | 41 | <include name="world/World.PacketHandlers.cs" /> |
40 | <include name="world/WorldScripting.cs" /> | 42 | <include name="world/World.Scripting.cs" /> |
41 | <include name="world/scripting/IScriptContext.cs" /> | 43 | <include name="world/scripting/IScriptContext.cs" /> |
42 | <include name="world/scripting/IScriptEntity.cs" /> | 44 | <include name="world/scripting/IScriptEntity.cs" /> |
43 | <include name="world/scripting/IScriptHandler.cs" /> | 45 | <include name="world/scripting/IScriptHandler.cs" /> |
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index fc604b7..9995d96 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -56,7 +56,6 @@ namespace OpenSim | |||
56 | 56 | ||
57 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback | 57 | public class OpenSimMain : OpenSimNetworkHandler, conscmd_callback |
58 | { | 58 | { |
59 | //private SimConfig Cfg; | ||
60 | private IGenericConfig localConfig; | 59 | private IGenericConfig localConfig; |
61 | //private IGenericConfig remoteConfig; | 60 | //private IGenericConfig remoteConfig; |
62 | private PhysicsManager physManager; | 61 | private PhysicsManager physManager; |
@@ -65,7 +64,6 @@ namespace OpenSim | |||
65 | private World LocalWorld; | 64 | private World LocalWorld; |
66 | private AssetCache AssetCache; | 65 | private AssetCache AssetCache; |
67 | private InventoryCache InventoryCache; | 66 | private InventoryCache InventoryCache; |
68 | //private Dictionary<uint, SimClient> ClientThreads = new Dictionary<uint, SimClient>(); | ||
69 | private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | 67 | private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); |
70 | private DateTime startuptime; | 68 | private DateTime startuptime; |
71 | private RegionInfo regionData; | 69 | private RegionInfo regionData; |
@@ -79,16 +77,16 @@ namespace OpenSim | |||
79 | private AsyncCallback ReceivedData; | 77 | private AsyncCallback ReceivedData; |
80 | 78 | ||
81 | private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); | 79 | private System.Timers.Timer m_heartbeatTimer = new System.Timers.Timer(); |
82 | //private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll"; | ||
83 | public string m_physicsEngine; | 80 | public string m_physicsEngine; |
84 | public bool m_sandbox = false; | 81 | public bool m_sandbox = false; |
85 | public bool m_loginserver; | 82 | public bool m_loginserver; |
86 | public OpenGridProtocolServer OGSServer; | ||
87 | public bool user_accounts = false; | 83 | public bool user_accounts = false; |
88 | public bool gridLocalAsset = false; | 84 | public bool gridLocalAsset = false; |
89 | private bool configFileSetup = false; | 85 | private bool configFileSetup = false; |
90 | public string m_config; | 86 | public string m_config; |
91 | 87 | ||
88 | protected BaseHttpServer httpServer; | ||
89 | |||
92 | protected ConsoleBase m_console; | 90 | protected ConsoleBase m_console; |
93 | 91 | ||
94 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool verbose, string configFile) | 92 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile, bool verbose, string configFile) |
@@ -122,42 +120,18 @@ namespace OpenSim | |||
122 | { | 120 | { |
123 | this.SetupFromConfigFile(this.localConfig); | 121 | this.SetupFromConfigFile(this.localConfig); |
124 | } | 122 | } |
125 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Loading configuration"); | 123 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Loading configuration"); |
126 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | 124 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); |
127 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 125 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change |
128 | 126 | ||
129 | |||
130 | GridServers = new Grid(); | 127 | GridServers = new Grid(); |
131 | if (m_sandbox) | 128 | if (m_sandbox) |
132 | { | 129 | { |
133 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | 130 | this.SetupLocalGridServers(); |
134 | GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; | ||
135 | |||
136 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Starting in Sandbox mode"); | ||
137 | } | 131 | } |
138 | else | 132 | else |
139 | { | 133 | { |
140 | if (this.gridLocalAsset) | 134 | this.SetupRemoteGridServers(); |
141 | { | ||
142 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
147 | } | ||
148 | GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
149 | |||
150 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Starting in Grid mode"); | ||
151 | } | ||
152 | |||
153 | try | ||
154 | { | ||
155 | GridServers.Initialise(); | ||
156 | } | ||
157 | catch (Exception e) | ||
158 | { | ||
159 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,e.Message + "\nSorry, could not setup the grid interface"); | ||
160 | Environment.Exit(1); | ||
161 | } | 135 | } |
162 | 136 | ||
163 | startuptime = DateTime.Now; | 137 | startuptime = DateTime.Now; |
@@ -169,63 +143,120 @@ namespace OpenSim | |||
169 | } | 143 | } |
170 | catch (Exception e) | 144 | catch (Exception e) |
171 | { | 145 | { |
172 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,e.Message + "\nSorry, could not setup local cache"); | 146 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup local cache"); |
173 | Environment.Exit(1); | 147 | Environment.Exit(1); |
174 | } | 148 | } |
175 | 149 | ||
176 | PacketServer packetServer = new PacketServer(this); | 150 | PacketServer packetServer = new PacketServer(this); |
177 | 151 | ||
178 | |||
179 | //should be passing a IGenericConfig object to these so they can read the config data they want from it | 152 | //should be passing a IGenericConfig object to these so they can read the config data they want from it |
180 | GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); | 153 | GridServers.AssetServer.SetServerInfo(regionData.AssetURL, regionData.AssetSendKey); |
181 | IGridServer gridServer = GridServers.GridServer; | 154 | IGridServer gridServer = GridServers.GridServer; |
182 | gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); | 155 | gridServer.SetServerInfo(regionData.GridURL, regionData.GridSendKey, regionData.GridRecvKey); |
183 | 156 | ||
184 | if (!m_sandbox) | 157 | if (!m_sandbox) |
185 | { | 158 | { |
186 | if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) | 159 | this.ConnectToRemoteGridServer(); |
160 | } | ||
161 | |||
162 | this.SetupLocalWorld(); | ||
163 | |||
164 | if (m_sandbox) | ||
165 | { | ||
166 | AssetCache.LoadDefaultTextureSet(); | ||
167 | } | ||
168 | |||
169 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Initialising HTTP server"); | ||
170 | |||
171 | this.SetupHttpListener(); | ||
172 | |||
173 | LoginServer loginServer = null; | ||
174 | LoginServer adminLoginServer = null; | ||
175 | |||
176 | bool sandBoxWithLoginServer = m_loginserver && m_sandbox; | ||
177 | if (sandBoxWithLoginServer) | ||
178 | { | ||
179 | loginServer = new LoginServer(gridServer, regionData.IPListenAddr, regionData.IPListenPort, regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); | ||
180 | loginServer.Startup(); | ||
181 | |||
182 | if (user_accounts) | ||
187 | { | 183 | { |
188 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Success: Got a grid connection OK!"); | 184 | //sandbox mode with loginserver using accounts |
185 | this.GridServers.UserServer = loginServer; | ||
186 | adminLoginServer = loginServer; | ||
187 | |||
188 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); | ||
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
192 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,"Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); | 192 | //sandbox mode with loginserver not using accounts |
193 | Shutdown(); | 193 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); |
194 | } | 194 | } |
195 | } | ||
195 | 196 | ||
196 | GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); | 197 | AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); |
198 | adminWebFront.LoadMethods(httpServer); | ||
197 | 199 | ||
198 | // If we are being told to load a file, load it. | 200 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting HTTP server"); |
199 | string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; | 201 | httpServer.Start(); |
200 | |||
201 | if ( !String.IsNullOrEmpty( dataUri ) ) | ||
202 | { | ||
203 | this.LocalWorld.m_datastore = dataUri; | ||
204 | } | ||
205 | 202 | ||
206 | if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") | 203 | MainServerListener(); |
207 | { | ||
208 | // The grid server has told us who we are | ||
209 | // We must obey the grid server. | ||
210 | try | ||
211 | { | ||
212 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); | ||
213 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | ||
214 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | ||
215 | } | ||
216 | catch (Exception e) | ||
217 | { | ||
218 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); | ||
219 | Environment.Exit(1); | ||
220 | } | ||
221 | } | ||
222 | 204 | ||
205 | m_heartbeatTimer.Enabled = true; | ||
206 | m_heartbeatTimer.Interval = 100; | ||
207 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | ||
208 | } | ||
209 | |||
210 | # region Setup methods | ||
211 | protected virtual void SetupLocalGridServers() | ||
212 | { | ||
213 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
214 | GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll"; | ||
215 | |||
216 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Sandbox mode"); | ||
217 | |||
218 | try | ||
219 | { | ||
220 | GridServers.Initialise(); | ||
221 | } | ||
222 | catch (Exception e) | ||
223 | { | ||
224 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); | ||
225 | Environment.Exit(1); | ||
226 | } | ||
227 | } | ||
228 | |||
229 | protected virtual void SetupRemoteGridServers() | ||
230 | { | ||
231 | if (this.gridLocalAsset) | ||
232 | { | ||
233 | GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll"; | ||
234 | } | ||
235 | else | ||
236 | { | ||
237 | GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
223 | } | 238 | } |
239 | GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll"; | ||
224 | 240 | ||
241 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Starting in Grid mode"); | ||
225 | 242 | ||
226 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL,"Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); | 243 | try |
227 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Initialising world"); | 244 | { |
245 | GridServers.Initialise(); | ||
246 | } | ||
247 | catch (Exception e) | ||
248 | { | ||
249 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, e.Message + "\nSorry, could not setup the grid interface"); | ||
250 | Environment.Exit(1); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | protected virtual void SetupLocalWorld() | ||
255 | { | ||
256 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.NORMAL, "Main.cs:Startup() - We are " + regionData.RegionName + " at " + regionData.RegionLocX.ToString() + "," + regionData.RegionLocY.ToString()); | ||
257 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Initialising world"); | ||
228 | m_console.componentname = "Region " + regionData.RegionName; | 258 | m_console.componentname = "Region " + regionData.RegionName; |
259 | |||
229 | LocalWorld = new World(this._packetServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); | 260 | LocalWorld = new World(this._packetServer.ClientThreads, regionData, regionData.RegionHandle, regionData.RegionName); |
230 | LocalWorld.InventoryCache = InventoryCache; | 261 | LocalWorld.InventoryCache = InventoryCache; |
231 | LocalWorld.AssetCache = AssetCache; | 262 | LocalWorld.AssetCache = AssetCache; |
@@ -241,28 +272,18 @@ namespace OpenSim | |||
241 | LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. | 272 | LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded. |
242 | LocalWorld.LoadWorldMap(); | 273 | LocalWorld.LoadWorldMap(); |
243 | 274 | ||
244 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting up messaging system"); | 275 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Starting up messaging system"); |
245 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use | 276 | LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this.m_physicsEngine); //should be reading from the config file what physics engine to use |
246 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); | 277 | LocalWorld.PhysScene.SetTerrain(LocalWorld.Terrain.getHeights1D()); |
247 | |||
248 | |||
249 | LocalWorld.LoadPrimsFromStorage(); | 278 | LocalWorld.LoadPrimsFromStorage(); |
279 | } | ||
250 | 280 | ||
251 | if (m_sandbox) | 281 | protected virtual void SetupHttpListener() |
252 | { | 282 | { |
253 | AssetCache.LoadDefaultTextureSet(); | 283 | httpServer = new BaseHttpServer(regionData.IPListenPort); |
254 | } | ||
255 | |||
256 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Initialising HTTP server"); | ||
257 | // HttpServer = new SimCAPSHTTPServer(GridServers.GridServer, Cfg.IPListenPort); | ||
258 | |||
259 | BaseHttpServer httpServer = new BaseHttpServer(regionData.IPListenPort); | ||
260 | 284 | ||
261 | if (gridServer.GetName() == "Remote") | 285 | if (this.GridServers.GridServer.GetName() == "Remote") |
262 | { | 286 | { |
263 | // should startup the OGS protocol server here | ||
264 | // Are we actually using this? | ||
265 | OGSServer = new OpenGridProtocolServer(this.regionData.IPListenPort - 500); // Changed so we can have more than one OGSServer per machine. | ||
266 | 287 | ||
267 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server | 288 | // we are in Grid mode so set a XmlRpc handler to handle "expect_user" calls from the user server |
268 | httpServer.AddXmlRPCHandler("expect_user", | 289 | httpServer.AddXmlRPCHandler("expect_user", |
@@ -286,13 +307,13 @@ namespace OpenSim | |||
286 | agent_data.child = false; | 307 | agent_data.child = false; |
287 | } | 308 | } |
288 | 309 | ||
289 | if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) | 310 | if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) |
290 | { | 311 | { |
291 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data; | 312 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode] = agent_data; |
292 | } | 313 | } |
293 | else | 314 | else |
294 | { | 315 | { |
295 | ((RemoteGridBase)gridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); | 316 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode, agent_data); |
296 | } | 317 | } |
297 | 318 | ||
298 | return new XmlRpcResponse(); | 319 | return new XmlRpcResponse(); |
@@ -308,11 +329,11 @@ namespace OpenSim | |||
308 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); | 329 | agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); |
309 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); | 330 | agent_data.startpos = new LLVector3(Single.Parse((string)requestData["pos_x"]), Single.Parse((string)requestData["pos_y"]), Single.Parse((string)requestData["pos_z"])); |
310 | 331 | ||
311 | if (((RemoteGridBase)gridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) | 332 | if (((RemoteGridBase)this.GridServers.GridServer).agentcircuits.ContainsKey((uint)agent_data.circuitcode)) |
312 | { | 333 | { |
313 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; | 334 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].firstname = agent_data.firstname; |
314 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; | 335 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].lastname = agent_data.lastname; |
315 | ((RemoteGridBase)gridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; | 336 | ((RemoteGridBase)this.GridServers.GridServer).agentcircuits[(uint)agent_data.circuitcode].startpos = agent_data.startpos; |
316 | } | 337 | } |
317 | 338 | ||
318 | return new XmlRpcResponse(); | 339 | return new XmlRpcResponse(); |
@@ -324,50 +345,50 @@ namespace OpenSim | |||
324 | return "OK"; | 345 | return "OK"; |
325 | }); | 346 | }); |
326 | } | 347 | } |
348 | } | ||
327 | 349 | ||
328 | LoginServer loginServer = null; | 350 | protected virtual void ConnectToRemoteGridServer() |
329 | LoginServer adminLoginServer = null; | 351 | { |
330 | 352 | if (GridServers.GridServer.RequestConnection(regionData.SimUUID, regionData.IPListenAddr, (uint)regionData.IPListenPort)) | |
331 | bool sandBoxWithLoginServer = m_loginserver && m_sandbox; | ||
332 | if (sandBoxWithLoginServer) | ||
333 | { | 353 | { |
334 | loginServer = new LoginServer(gridServer, regionData.IPListenAddr, regionData.IPListenPort,regionData.RegionLocX, regionData.RegionLocY, this.user_accounts); | 354 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Startup() - Success: Got a grid connection OK!"); |
335 | loginServer.Startup(); | 355 | } |
336 | 356 | else | |
337 | if (user_accounts) | 357 | { |
338 | { | 358 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, "Main.cs:Startup() - FAILED: Unable to get connection to grid. Shutting down."); |
339 | //sandbox mode with loginserver using accounts | 359 | Shutdown(); |
340 | this.GridServers.UserServer = loginServer; | ||
341 | adminLoginServer = loginServer; | ||
342 | |||
343 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.LocalUserManager.XmlRpcLoginMethod); | ||
344 | } | ||
345 | else | ||
346 | { | ||
347 | //sandbox mode with loginserver not using accounts | ||
348 | httpServer.AddXmlRPCHandler("login_to_simulator", loginServer.XmlRpcLoginMethod); | ||
349 | } | ||
350 | } | 360 | } |
351 | 361 | ||
352 | AdminWebFront adminWebFront = new AdminWebFront("Admin", LocalWorld, InventoryCache, adminLoginServer); | 362 | GridServers.AssetServer.SetServerInfo((string)((RemoteGridBase)GridServers.GridServer).GridData["asset_url"], (string)((RemoteGridBase)GridServers.GridServer).GridData["asset_sendkey"]); |
353 | adminWebFront.LoadMethods(httpServer); | ||
354 | 363 | ||
355 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting HTTP server"); | 364 | // If we are being told to load a file, load it. |
356 | httpServer.Start(); | 365 | string dataUri = (string)((RemoteGridBase)GridServers.GridServer).GridData["data_uri"]; |
357 | 366 | ||
358 | if (gridServer.GetName() == "Remote") | 367 | if (!String.IsNullOrEmpty(dataUri)) |
359 | { | 368 | { |
360 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Startup() - Starting up OGS protocol server"); | 369 | this.LocalWorld.m_datastore = dataUri; |
361 | OGSServer.Start(); | ||
362 | } | 370 | } |
363 | 371 | ||
364 | MainServerListener(); | 372 | if (((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString() != "") |
365 | 373 | { | |
366 | m_heartbeatTimer.Enabled = true; | 374 | // The grid server has told us who we are |
367 | m_heartbeatTimer.Interval = 100; | 375 | // We must obey the grid server. |
368 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | 376 | try |
377 | { | ||
378 | regionData.RegionLocX = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locx"].ToString()); | ||
379 | regionData.RegionLocY = Convert.ToUInt32(((RemoteGridBase)(GridServers.GridServer)).GridData["region_locy"].ToString()); | ||
380 | regionData.RegionName = ((RemoteGridBase)(GridServers.GridServer)).GridData["regionname"].ToString(); | ||
381 | } | ||
382 | catch (Exception e) | ||
383 | { | ||
384 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL, e.Message + "\nBAD ERROR! THIS SHOULD NOT HAPPEN! Bad GridData from the grid interface!!!! ZOMG!!!"); | ||
385 | Environment.Exit(1); | ||
386 | } | ||
387 | } | ||
369 | } | 388 | } |
370 | 389 | ||
390 | #endregion | ||
391 | |||
371 | private void SetupFromConfigFile(IGenericConfig configData) | 392 | private void SetupFromConfigFile(IGenericConfig configData) |
372 | { | 393 | { |
373 | try | 394 | try |
@@ -430,7 +451,7 @@ namespace OpenSim | |||
430 | switch (attri) | 451 | switch (attri) |
431 | { | 452 | { |
432 | default: | 453 | default: |
433 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM,"Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); | 454 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "Main.cs: SetupFromConfig() - Invalid value for PhysicsEngine attribute, terminating"); |
434 | Environment.Exit(1); | 455 | Environment.Exit(1); |
435 | break; | 456 | break; |
436 | 457 | ||
@@ -468,44 +489,7 @@ namespace OpenSim | |||
468 | } | 489 | } |
469 | } | 490 | } |
470 | 491 | ||
471 | private SimConfig LoadConfigDll(string dllName) | 492 | # region UDP |
472 | { | ||
473 | try | ||
474 | { | ||
475 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | ||
476 | SimConfig config = null; | ||
477 | |||
478 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
479 | { | ||
480 | if (pluginType.IsPublic) | ||
481 | { | ||
482 | if (!pluginType.IsAbstract) | ||
483 | { | ||
484 | Type typeInterface = pluginType.GetInterface("ISimConfig", true); | ||
485 | |||
486 | if (typeInterface != null) | ||
487 | { | ||
488 | ISimConfig plug = (ISimConfig)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
489 | config = plug.GetConfigObject(); | ||
490 | break; | ||
491 | } | ||
492 | |||
493 | typeInterface = null; | ||
494 | } | ||
495 | } | ||
496 | } | ||
497 | pluginAssembly = null; | ||
498 | return config; | ||
499 | } | ||
500 | catch (Exception e) | ||
501 | { | ||
502 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,e.Message + "\nSorry, a fatal error occurred while trying to load the config DLL"); | ||
503 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.CRITICAL,"Can not continue starting up"); | ||
504 | Environment.Exit(1); | ||
505 | return null; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | private void OnReceivedData(IAsyncResult result) | 493 | private void OnReceivedData(IAsyncResult result) |
510 | { | 494 | { |
511 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 495 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |
@@ -544,7 +528,7 @@ namespace OpenSim | |||
544 | this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); | 528 | this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); |
545 | 529 | ||
546 | //if (!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) | 530 | //if (!((RemoteGridBase)GridServers.GridServer).agentcircuits[useCircuit.CircuitCode.Code].child) |
547 | 531 | ||
548 | 532 | ||
549 | } | 533 | } |
550 | else | 534 | else |
@@ -557,21 +541,21 @@ namespace OpenSim | |||
557 | 541 | ||
558 | private void MainServerListener() | 542 | private void MainServerListener() |
559 | { | 543 | { |
560 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:MainServerListener() - New thread started"); | 544 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:MainServerListener() - New thread started"); |
561 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:MainServerListener() - Opening UDP socket on " + regionData.IPListenAddr + ":" + regionData.IPListenPort); | 545 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:MainServerListener() - Opening UDP socket on " + regionData.IPListenAddr + ":" + regionData.IPListenPort); |
562 | 546 | ||
563 | ServerIncoming = new IPEndPoint(IPAddress.Any, regionData.IPListenPort); | 547 | ServerIncoming = new IPEndPoint(IPAddress.Any, regionData.IPListenPort); |
564 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | 548 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
565 | Server.Bind(ServerIncoming); | 549 | Server.Bind(ServerIncoming); |
566 | 550 | ||
567 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); | 551 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); |
568 | 552 | ||
569 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | 553 | ipeSender = new IPEndPoint(IPAddress.Any, 0); |
570 | epSender = (EndPoint)ipeSender; | 554 | epSender = (EndPoint)ipeSender; |
571 | ReceivedData = new AsyncCallback(this.OnReceivedData); | 555 | ReceivedData = new AsyncCallback(this.OnReceivedData); |
572 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | 556 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); |
573 | 557 | ||
574 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:MainServerListener() - Listening..."); | 558 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:MainServerListener() - Listening..."); |
575 | 559 | ||
576 | } | 560 | } |
577 | 561 | ||
@@ -611,16 +595,18 @@ namespace OpenSim | |||
611 | } | 595 | } |
612 | } | 596 | } |
613 | 597 | ||
598 | #endregion | ||
599 | |||
614 | /// <summary> | 600 | /// <summary> |
615 | /// Performs any last-minute sanity checking and shuts down the region server | 601 | /// Performs any last-minute sanity checking and shuts down the region server |
616 | /// </summary> | 602 | /// </summary> |
617 | public virtual void Shutdown() | 603 | public virtual void Shutdown() |
618 | { | 604 | { |
619 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Shutdown() - Closing all threads"); | 605 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing all threads"); |
620 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Shutdown() - Killing listener thread"); | 606 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing listener thread"); |
621 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Shutdown() - Killing clients"); | 607 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Killing clients"); |
622 | // IMPLEMENT THIS | 608 | // IMPLEMENT THIS |
623 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW,"Main.cs:Shutdown() - Closing console and terminating"); | 609 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.LOW, "Main.cs:Shutdown() - Closing console and terminating"); |
624 | LocalWorld.Close(); | 610 | LocalWorld.Close(); |
625 | GridServers.Close(); | 611 | GridServers.Close(); |
626 | m_console.Close(); | 612 | m_console.Close(); |
@@ -637,6 +623,7 @@ namespace OpenSim | |||
637 | LocalWorld.Update(); | 623 | LocalWorld.Update(); |
638 | } | 624 | } |
639 | 625 | ||
626 | #region Console Commands | ||
640 | /// <summary> | 627 | /// <summary> |
641 | /// Runs commands issued by the server console from the operator | 628 | /// Runs commands issued by the server console from the operator |
642 | /// </summary> | 629 | /// </summary> |
@@ -647,8 +634,8 @@ namespace OpenSim | |||
647 | switch (command) | 634 | switch (command) |
648 | { | 635 | { |
649 | case "help": | 636 | case "help": |
650 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"show users - show info about connected users"); | 637 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "show users - show info about connected users"); |
651 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"shutdown - disconnect all clients and shutdown"); | 638 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "shutdown - disconnect all clients and shutdown"); |
652 | break; | 639 | break; |
653 | 640 | ||
654 | case "show": | 641 | case "show": |
@@ -659,7 +646,7 @@ namespace OpenSim | |||
659 | string result = ""; | 646 | string result = ""; |
660 | if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) | 647 | if (!LocalWorld.Terrain.RunTerrainCmd(cmdparams, ref result)) |
661 | { | 648 | { |
662 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,result); | 649 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, result); |
663 | } | 650 | } |
664 | break; | 651 | break; |
665 | 652 | ||
@@ -668,7 +655,7 @@ namespace OpenSim | |||
668 | break; | 655 | break; |
669 | 656 | ||
670 | default: | 657 | default: |
671 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"Unknown command"); | 658 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "Unknown command"); |
672 | break; | 659 | break; |
673 | } | 660 | } |
674 | } | 661 | } |
@@ -682,23 +669,24 @@ namespace OpenSim | |||
682 | switch (ShowWhat) | 669 | switch (ShowWhat) |
683 | { | 670 | { |
684 | case "uptime": | 671 | case "uptime": |
685 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"OpenSim has been running since " + startuptime.ToString()); | 672 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "OpenSim has been running since " + startuptime.ToString()); |
686 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,"That is " + (DateTime.Now - startuptime).ToString()); | 673 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, "That is " + (DateTime.Now - startuptime).ToString()); |
687 | break; | 674 | break; |
688 | case "users": | 675 | case "users": |
689 | OpenSim.world.Avatar TempAv; | 676 | OpenSim.world.Avatar TempAv; |
690 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); | 677 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}", "Firstname", "Lastname", "Agent ID", "Session ID", "Circuit", "IP")); |
691 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) | 678 | foreach (libsecondlife.LLUUID UUID in LocalWorld.Entities.Keys) |
692 | { | 679 | { |
693 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") | 680 | if (LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") |
694 | { | 681 | { |
695 | TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; | 682 | TempAv = (OpenSim.world.Avatar)LocalWorld.Entities[UUID]; |
696 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH,String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); | 683 | m_console.WriteLine(OpenSim.Framework.Console.LogPriority.HIGH, String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString())); |
697 | } | 684 | } |
698 | } | 685 | } |
699 | break; | 686 | break; |
700 | } | 687 | } |
701 | } | 688 | } |
689 | #endregion | ||
702 | } | 690 | } |
703 | 691 | ||
704 | 692 | ||
diff --git a/OpenSim.RegionServer/OpenSimNetworkHandler.cs b/OpenSim.RegionServer/OpenSimNetworkHandler.cs index 6649120..e3a7375 100644 --- a/OpenSim.RegionServer/OpenSimNetworkHandler.cs +++ b/OpenSim.RegionServer/OpenSimNetworkHandler.cs | |||
@@ -8,8 +8,6 @@ namespace OpenSim | |||
8 | { | 8 | { |
9 | public interface OpenSimNetworkHandler | 9 | public interface OpenSimNetworkHandler |
10 | { | 10 | { |
11 | //public abstract void StartUp(); | ||
12 | // public abstract void Shutdown(); | ||
13 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); | 11 | void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode);// EndPoint packetSender); |
14 | void RemoveClientCircuit(uint circuitcode); | 12 | void RemoveClientCircuit(uint circuitcode); |
15 | void RegisterPacketServer(PacketServer server); | 13 | void RegisterPacketServer(PacketServer server); |
diff --git a/OpenSim.RegionServer/QueItem.cs b/OpenSim.RegionServer/QueItem.cs deleted file mode 100644 index d9b77ba..0000000 --- a/OpenSim.RegionServer/QueItem.cs +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife.Packets; | ||
5 | |||
6 | namespace OpenSim | ||
7 | { | ||
8 | /* | ||
9 | public class QueItem | ||
10 | { | ||
11 | public QueItem() | ||
12 | { | ||
13 | } | ||
14 | |||
15 | public Packet Packet; | ||
16 | public bool Incoming; | ||
17 | }*/ | ||
18 | |||
19 | } | ||
diff --git a/OpenSim.RegionServer/RegionInfo.cs b/OpenSim.RegionServer/RegionInfo.cs index 2707257..f82495a 100644 --- a/OpenSim.RegionServer/RegionInfo.cs +++ b/OpenSim.RegionServer/RegionInfo.cs | |||
@@ -10,19 +10,8 @@ using libsecondlife; | |||
10 | 10 | ||
11 | namespace OpenSim | 11 | namespace OpenSim |
12 | { | 12 | { |
13 | public class RegionInfo // could inherit from SimProfileBase | 13 | public class RegionInfo : RegionInfoBase |
14 | { | 14 | { |
15 | public LLUUID SimUUID; | ||
16 | public string RegionName; | ||
17 | public uint RegionLocX; | ||
18 | public uint RegionLocY; | ||
19 | public ulong RegionHandle; | ||
20 | public ushort RegionWaterHeight = 20; | ||
21 | public bool RegionTerraform = true; | ||
22 | |||
23 | public int IPListenPort; | ||
24 | public string IPListenAddr; | ||
25 | |||
26 | //following should be removed and the GenericConfig object passed around, | 15 | //following should be removed and the GenericConfig object passed around, |
27 | //so each class (AssetServer, GridServer etc) can access what config data they want | 16 | //so each class (AssetServer, GridServer etc) can access what config data they want |
28 | public string AssetURL = "http://127.0.0.1:8003/"; | 17 | public string AssetURL = "http://127.0.0.1:8003/"; |
diff --git a/OpenSim.RegionServer/RegionInfoBase.cs b/OpenSim.RegionServer/RegionInfoBase.cs new file mode 100644 index 0000000..42d3030 --- /dev/null +++ b/OpenSim.RegionServer/RegionInfoBase.cs | |||
@@ -0,0 +1,32 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using System.Net; | ||
5 | using System.Web; | ||
6 | using System.IO; | ||
7 | using OpenSim.Framework.Interfaces; | ||
8 | using OpenSim.Framework.Utilities; | ||
9 | using libsecondlife; | ||
10 | |||
11 | namespace OpenSim | ||
12 | { | ||
13 | public class RegionInfoBase | ||
14 | { | ||
15 | public LLUUID SimUUID; | ||
16 | public string RegionName; | ||
17 | public uint RegionLocX; | ||
18 | public uint RegionLocY; | ||
19 | public ulong RegionHandle; | ||
20 | public ushort RegionWaterHeight = 20; | ||
21 | public bool RegionTerraform = true; | ||
22 | |||
23 | public int IPListenPort; | ||
24 | public string IPListenAddr; | ||
25 | |||
26 | public RegionInfoBase() | ||
27 | { | ||
28 | |||
29 | } | ||
30 | } | ||
31 | |||
32 | } | ||
diff --git a/OpenSim.RegionServer/SimClient(Grid).cs b/OpenSim.RegionServer/SimClient.Grid.cs index b0d59cc..b0d59cc 100644 --- a/OpenSim.RegionServer/SimClient(Grid).cs +++ b/OpenSim.RegionServer/SimClient.Grid.cs | |||
diff --git a/OpenSim.RegionServer/SimClientPacketHandlers.cs b/OpenSim.RegionServer/SimClient.PacketHandlers.cs index 5007a60..5007a60 100644 --- a/OpenSim.RegionServer/SimClientPacketHandlers.cs +++ b/OpenSim.RegionServer/SimClient.PacketHandlers.cs | |||
diff --git a/OpenSim.RegionServer/SimClientBase.cs b/OpenSim.RegionServer/SimClientBase.cs new file mode 100644 index 0000000..d0dd381 --- /dev/null +++ b/OpenSim.RegionServer/SimClientBase.cs | |||
@@ -0,0 +1,32 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | using libsecondlife; | ||
5 | using libsecondlife.Packets; | ||
6 | |||
7 | namespace OpenSim | ||
8 | { | ||
9 | public class SimClientBase | ||
10 | { | ||
11 | |||
12 | protected virtual void ProcessInPacket(Packet Pack) | ||
13 | { | ||
14 | |||
15 | } | ||
16 | |||
17 | protected virtual void ProcessOutPacket(Packet Pack) | ||
18 | { | ||
19 | |||
20 | } | ||
21 | |||
22 | public virtual void InPacket(Packet NewPack) | ||
23 | { | ||
24 | |||
25 | } | ||
26 | |||
27 | public virtual void OutPacket(Packet NewPack) | ||
28 | { | ||
29 | |||
30 | } | ||
31 | } | ||
32 | } | ||
diff --git a/OpenSim.RegionServer/UDPServer.cs b/OpenSim.RegionServer/UDPServer.cs new file mode 100644 index 0000000..e70ae78 --- /dev/null +++ b/OpenSim.RegionServer/UDPServer.cs | |||
@@ -0,0 +1,164 @@ | |||
1 | using System; | ||
2 | using System.Text; | ||
3 | using System.IO; | ||
4 | using System.Threading; | ||
5 | using System.Net; | ||
6 | using System.Net.Sockets; | ||
7 | using System.Timers; | ||
8 | using System.Reflection; | ||
9 | using System.Collections; | ||
10 | using System.Collections.Generic; | ||
11 | using libsecondlife; | ||
12 | using libsecondlife.Packets; | ||
13 | using OpenSim.world; | ||
14 | using OpenSim.Terrain; | ||
15 | using OpenSim.Framework.Interfaces; | ||
16 | using OpenSim.Framework.Types; | ||
17 | using OpenSim.UserServer; | ||
18 | using OpenSim.Assets; | ||
19 | using OpenSim.CAPS; | ||
20 | using OpenSim.Framework.Console; | ||
21 | using Nwc.XmlRpc; | ||
22 | using OpenSim.Servers; | ||
23 | using OpenSim.GenericConfig; | ||
24 | |||
25 | namespace OpenSim | ||
26 | { | ||
27 | public class UDPServer : OpenSimNetworkHandler | ||
28 | { | ||
29 | private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>(); | ||
30 | public Socket Server; | ||
31 | private IPEndPoint ServerIncoming; | ||
32 | private byte[] RecvBuffer = new byte[4096]; | ||
33 | private byte[] ZeroBuffer = new byte[8192]; | ||
34 | private IPEndPoint ipeSender; | ||
35 | private EndPoint epSender; | ||
36 | private AsyncCallback ReceivedData; | ||
37 | private PacketServer _packetServer; | ||
38 | |||
39 | private int listenPort; | ||
40 | private Grid m_gridServers; | ||
41 | private World m_localWorld; | ||
42 | private AssetCache m_assetCache; | ||
43 | private InventoryCache m_inventoryCache; | ||
44 | private RegionInfo m_regionData; | ||
45 | private bool m_sandbox = false; | ||
46 | private bool user_accounts = false; | ||
47 | private ConsoleBase m_console; | ||
48 | |||
49 | public UDPServer(int port, Grid gridServers, World localWorld, AssetCache assetCache, InventoryCache inventoryCache, RegionInfo _regionData, bool sandbox, bool accounts, ConsoleBase console) | ||
50 | { | ||
51 | listenPort = port; | ||
52 | this.m_gridServers = gridServers; | ||
53 | this.m_localWorld = localWorld; | ||
54 | this.m_assetCache = assetCache; | ||
55 | this.m_inventoryCache = inventoryCache; | ||
56 | this.m_regionData = _regionData; | ||
57 | this.m_sandbox = sandbox; | ||
58 | this.user_accounts = accounts; | ||
59 | this.m_console = console; | ||
60 | PacketServer packetServer = new PacketServer(this); | ||
61 | this._packetServer.LocalWorld = m_localWorld; | ||
62 | this._packetServer.RegisterClientPacketHandlers(); | ||
63 | } | ||
64 | |||
65 | protected virtual void OnReceivedData(IAsyncResult result) | ||
66 | { | ||
67 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
68 | epSender = (EndPoint)ipeSender; | ||
69 | Packet packet = null; | ||
70 | int numBytes = Server.EndReceiveFrom(result, ref epSender); | ||
71 | int packetEnd = numBytes - 1; | ||
72 | |||
73 | packet = Packet.BuildPacket(RecvBuffer, ref packetEnd, ZeroBuffer); | ||
74 | |||
75 | // do we already have a circuit for this endpoint | ||
76 | if (this.clientCircuits.ContainsKey(epSender)) | ||
77 | { | ||
78 | //if so then send packet to the packetserver | ||
79 | this._packetServer.ClientInPacket(this.clientCircuits[epSender], packet); | ||
80 | } | ||
81 | else if (packet.Type == PacketType.UseCircuitCode) | ||
82 | { | ||
83 | // new client | ||
84 | this.AddNewClient(packet); | ||
85 | } | ||
86 | else | ||
87 | { // invalid client | ||
88 | Console.Error.WriteLine("Main.cs:OnReceivedData() - WARNING: Got a packet from an invalid client - " + epSender.ToString()); | ||
89 | } | ||
90 | |||
91 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
92 | } | ||
93 | |||
94 | protected virtual void AddNewClient(Packet packet) | ||
95 | { | ||
96 | UseCircuitCodePacket useCircuit = (UseCircuitCodePacket)packet; | ||
97 | this.clientCircuits.Add(epSender, useCircuit.CircuitCode.Code); | ||
98 | bool isChildAgent = false; | ||
99 | |||
100 | SimClient newuser = new SimClient(epSender, useCircuit, m_localWorld, _packetServer.ClientThreads, m_assetCache, m_gridServers.GridServer, this, m_inventoryCache, m_sandbox, isChildAgent, this.m_regionData); | ||
101 | if ((this.m_gridServers.UserServer != null) && (user_accounts)) | ||
102 | { | ||
103 | newuser.UserServer = this.m_gridServers.UserServer; | ||
104 | } | ||
105 | //OpenSimRoot.Instance.ClientThreads.Add(epSender, newuser); | ||
106 | this._packetServer.ClientThreads.Add(useCircuit.CircuitCode.Code, newuser); | ||
107 | } | ||
108 | |||
109 | private void ServerListener() | ||
110 | { | ||
111 | m_console.WriteLine("Main.cs:MainServerListener() - Opening UDP socket on " + listenPort); | ||
112 | |||
113 | ServerIncoming = new IPEndPoint(IPAddress.Any, listenPort); | ||
114 | Server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); | ||
115 | Server.Bind(ServerIncoming); | ||
116 | |||
117 | m_console.WriteLine("Main.cs:MainServerListener() - UDP socket bound, getting ready to listen"); | ||
118 | |||
119 | ipeSender = new IPEndPoint(IPAddress.Any, 0); | ||
120 | epSender = (EndPoint)ipeSender; | ||
121 | ReceivedData = new AsyncCallback(this.OnReceivedData); | ||
122 | Server.BeginReceiveFrom(RecvBuffer, 0, RecvBuffer.Length, SocketFlags.None, ref epSender, ReceivedData, null); | ||
123 | |||
124 | m_console.WriteLine("Main.cs:MainServerListener() - Listening..."); | ||
125 | |||
126 | } | ||
127 | |||
128 | public void RegisterPacketServer(PacketServer server) | ||
129 | { | ||
130 | this._packetServer = server; | ||
131 | } | ||
132 | |||
133 | public virtual void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode)//EndPoint packetSender) | ||
134 | { | ||
135 | // find the endpoint for this circuit | ||
136 | EndPoint sendto = null; | ||
137 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | ||
138 | { | ||
139 | if (p.Value == circuitcode) | ||
140 | { | ||
141 | sendto = p.Key; | ||
142 | break; | ||
143 | } | ||
144 | } | ||
145 | if (sendto != null) | ||
146 | { | ||
147 | //we found the endpoint so send the packet to it | ||
148 | this.Server.SendTo(buffer, size, flags, sendto); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | public virtual void RemoveClientCircuit(uint circuitcode) | ||
153 | { | ||
154 | foreach (KeyValuePair<EndPoint, uint> p in this.clientCircuits) | ||
155 | { | ||
156 | if (p.Value == circuitcode) | ||
157 | { | ||
158 | this.clientCircuits.Remove(p.Key); | ||
159 | break; | ||
160 | } | ||
161 | } | ||
162 | } | ||
163 | } | ||
164 | } \ No newline at end of file | ||
diff --git a/OpenSim.RegionServer/world/AvatarClient.cs b/OpenSim.RegionServer/world/Avatar.Client.cs index 7656a89..7656a89 100644 --- a/OpenSim.RegionServer/world/AvatarClient.cs +++ b/OpenSim.RegionServer/world/Avatar.Client.cs | |||
diff --git a/OpenSim.RegionServer/world/AvatarUpdate.cs b/OpenSim.RegionServer/world/Avatar.Update.cs index ba2965d..ba2965d 100644 --- a/OpenSim.RegionServer/world/AvatarUpdate.cs +++ b/OpenSim.RegionServer/world/Avatar.Update.cs | |||
diff --git a/OpenSim.RegionServer/world/WorldPacketHandlers.cs b/OpenSim.RegionServer/world/World.PacketHandlers.cs index 2036bc6..2036bc6 100644 --- a/OpenSim.RegionServer/world/WorldPacketHandlers.cs +++ b/OpenSim.RegionServer/world/World.PacketHandlers.cs | |||
diff --git a/OpenSim.RegionServer/world/WorldScripting.cs b/OpenSim.RegionServer/world/World.Scripting.cs index 44ef05a..44ef05a 100644 --- a/OpenSim.RegionServer/world/WorldScripting.cs +++ b/OpenSim.RegionServer/world/World.Scripting.cs | |||