Another attemp to fix the Session Logout bug
World map data is now saved in database and recovered on startup. Primitives are now backed up to a local database and reloaded on startup.adam
parent
c8a9387cda
commit
f60bc970eb
|
@ -111,16 +111,19 @@ namespace Db40SimConfig
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Loading world....");
|
||||||
World blank = new World();
|
World blank = new World();
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Looking for a heightmap in local DB");
|
||||||
IObjectSet world_result = db.Get(new float[65536]);
|
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||||
if(world_result.Count>0) {
|
if(world_result.Count>0) {
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Found a heightmap in local database, loading");
|
||||||
blank.LandMap=(float[])world_result.Next();
|
MapStorage map=(MapStorage)world_result.Next();
|
||||||
|
blank.LandMap = map.Map;
|
||||||
} else {
|
} else {
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - No heightmap found, generating new one");
|
||||||
HeightmapGenHills hills = new HeightmapGenHills();
|
HeightmapGenHills hills = new HeightmapGenHills();
|
||||||
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
ServerConsole.MainConsole.Instance.WriteLine("Config.cs:LoadWorld() - Saving heightmap to local database");
|
||||||
db.Set(blank.LandMap);
|
MapStorage map= new MapStorage();
|
||||||
|
map.Map = blank.LandMap;
|
||||||
|
db.Set(map);
|
||||||
db.Commit();
|
db.Commit();
|
||||||
}
|
}
|
||||||
return blank;
|
return blank;
|
||||||
|
@ -143,4 +146,14 @@ namespace Db40SimConfig
|
||||||
db.Close();
|
db.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MapStorage
|
||||||
|
{
|
||||||
|
public float[] Map;
|
||||||
|
|
||||||
|
public MapStorage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
|
<Project>{132A6E3E-8F2D-4BF5-BDFB-8555F53F334E}</Project>
|
||||||
<Name>Second-server</Name>
|
<Name>Second-server</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
|
||||||
|
<Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
|
||||||
|
<Name>GridInterfaces</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -35,6 +35,7 @@
|
||||||
<Compile Include="IAssetServer.cs" />
|
<Compile Include="IAssetServer.cs" />
|
||||||
<Compile Include="AssemblyInfo.cs" />
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
<Compile Include="IGridServer.cs" />
|
<Compile Include="IGridServer.cs" />
|
||||||
|
<Compile Include="ILocalStorage.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||||
</Project>
|
</Project>
|
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace GridInterfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ILocalStorage. Really hacked together right now needs cleaning up
|
||||||
|
/// </summary>
|
||||||
|
public interface ILocalStorage
|
||||||
|
{
|
||||||
|
void StorePrim(PrimStorage prim);
|
||||||
|
void RemovePrim(LLUUID primID);
|
||||||
|
void LoadPrimitives(ILocalStorageReceiver receiver);
|
||||||
|
void ShutDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ILocalStorageReceiver
|
||||||
|
{
|
||||||
|
void PrimFromStorage(PrimStorage prim);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrimStorage
|
||||||
|
{
|
||||||
|
public PrimData Data;
|
||||||
|
public LLVector3 Position;
|
||||||
|
public LLQuaternion Rotation;
|
||||||
|
public uint LocalID;
|
||||||
|
public LLUUID FullID;
|
||||||
|
|
||||||
|
public PrimStorage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class PrimData
|
||||||
|
{
|
||||||
|
public LLUUID OwnerID;
|
||||||
|
public byte PCode;
|
||||||
|
public byte PathBegin;
|
||||||
|
public byte PathEnd;
|
||||||
|
public byte PathScaleX;
|
||||||
|
public byte PathScaleY;
|
||||||
|
public byte PathShearX;
|
||||||
|
public byte PathShearY;
|
||||||
|
public sbyte PathSkew;
|
||||||
|
public byte ProfileBegin;
|
||||||
|
public byte ProfileEnd;
|
||||||
|
public LLVector3 Scale;
|
||||||
|
public byte PathCurve;
|
||||||
|
public byte ProfileCurve;
|
||||||
|
public uint ParentID=0;
|
||||||
|
public byte ProfileHollow;
|
||||||
|
|
||||||
|
public PrimData()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following
|
||||||
|
// attributes.
|
||||||
|
//
|
||||||
|
// change them to the information which is associated with the assembly
|
||||||
|
// you compile.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("Db4LocalStorage")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Db4LocalStorage")]
|
||||||
|
[assembly: AssemblyCopyright("")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The assembly version has following format :
|
||||||
|
//
|
||||||
|
// Major.Minor.Build.Revision
|
||||||
|
//
|
||||||
|
// You can specify all values by your own or you can build default build and revision
|
||||||
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the <organization> nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Db4objects.Db4o;
|
||||||
|
using Db4objects.Db4o.Query;
|
||||||
|
using libsecondlife;
|
||||||
|
using GridInterfaces;
|
||||||
|
|
||||||
|
namespace Db4LocalStorage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class Db4LocalStorage : ILocalStorage
|
||||||
|
{
|
||||||
|
private IObjectContainer db;
|
||||||
|
|
||||||
|
public Db4LocalStorage()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
db = Db4oFactory.OpenFile("localworld.yap");
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage creation");
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
db.Close();
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage :Constructor - Exception occured");
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine(e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StorePrim(PrimStorage prim)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new UUIDQuery(prim.FullID));
|
||||||
|
if(result.Count>0)
|
||||||
|
{
|
||||||
|
//prim already in storage
|
||||||
|
//so update it
|
||||||
|
PrimStorage found = (PrimStorage) result.Next();
|
||||||
|
found.Data = prim.Data;
|
||||||
|
found.Position = prim.Position;
|
||||||
|
found.Rotation = prim.Rotation;
|
||||||
|
db.Set(found);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//not in storage
|
||||||
|
db.Set(prim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemovePrim(LLUUID primID)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Query(new UUIDQuery(primID));
|
||||||
|
if(result.Count>0)
|
||||||
|
{
|
||||||
|
PrimStorage found = (PrimStorage) result.Next();
|
||||||
|
db.Delete(found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void LoadPrimitives(ILocalStorageReceiver receiver)
|
||||||
|
{
|
||||||
|
IObjectSet result = db.Get(typeof(PrimStorage));
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("Db4LocalStorage.cs: LoadPrimitives() - number of prims in storages is "+result.Count);
|
||||||
|
foreach (PrimStorage prim in result) {
|
||||||
|
receiver.PrimFromStorage(prim);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShutDown()
|
||||||
|
{
|
||||||
|
db.Commit();
|
||||||
|
db.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class UUIDQuery : Predicate
|
||||||
|
{
|
||||||
|
private LLUUID _findID;
|
||||||
|
|
||||||
|
public UUIDQuery(LLUUID find)
|
||||||
|
{
|
||||||
|
_findID = find;
|
||||||
|
}
|
||||||
|
public bool Match(PrimStorage prim)
|
||||||
|
{
|
||||||
|
return (prim.FullID == _findID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>Db4LocalStorage</RootNamespace>
|
||||||
|
<AssemblyName>Db4LocalStorage</AssemblyName>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{74784F23-B0FD-484C-82C1-96C0215733DC}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
|
<Optimize>False</Optimize>
|
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DebugSymbols>True</DebugSymbols>
|
||||||
|
<DebugType>Full</DebugType>
|
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
|
<Optimize>True</Optimize>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<DebugSymbols>False</DebugSymbols>
|
||||||
|
<DebugType>None</DebugType>
|
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
<Reference Include="Db4objects.Db4o">
|
||||||
|
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="libsecondlife">
|
||||||
|
<HintPath>..\..\..\..\..\..\..\Libsecond-dailys\libsl07-03\trunk\libsecondlife-cs\obj\Debug\libsecondlife.dll</HintPath>
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Db4LocalStorage.cs" />
|
||||||
|
<Compile Include="AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\GridInterfaces\GridInterfaces.csproj">
|
||||||
|
<Project>{5DA3174D-42F9-416D-9F0B-AF41FA2BE2F9}</Project>
|
||||||
|
<Name>GridInterfaces</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\ServerConsole\ServerConsole\ServerConsole.csproj">
|
||||||
|
<Project>{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}</Project>
|
||||||
|
<Name>ServerConsole</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
|
||||||
|
</Project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||||
|
# SharpDevelop 2.1.0.2017
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
EndGlobal
|
|
@ -150,9 +150,13 @@ namespace OpenSim
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||||
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
local_world.PhysScene = this.physManager.GetPhysicsScene("PhysX"); //should be reading from the config file what physics engine to use
|
||||||
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
local_world.PhysScene.SetTerrain(local_world.LandMap);
|
||||||
|
|
||||||
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
OpenSim_Main.gridServers.AssetServer.SetServerInfo(OpenSim_Main.cfg.AssetURL, OpenSim_Main.cfg.AssetSendKey);
|
||||||
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
OpenSim_Main.gridServers.GridServer.SetServerInfo(OpenSim_Main.cfg.GridURL, OpenSim_Main.cfg.GridSendKey);
|
||||||
|
|
||||||
|
local_world.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
|
||||||
|
local_world.LoadPrimsFromStorage();
|
||||||
|
|
||||||
MainServerListener();
|
MainServerListener();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -230,6 +234,7 @@ namespace OpenSim
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Killing clients");
|
||||||
// IMPLEMENT THIS
|
// IMPLEMENT THIS
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
ServerConsole.MainConsole.Instance.WriteLine("Main.cs:Shutdown() - Closing console and terminating");
|
||||||
|
OpenSim_Main.local_world.Close();
|
||||||
ServerConsole.MainConsole.Instance.Close();
|
ServerConsole.MainConsole.Instance.Close();
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,7 @@ namespace OpenSim
|
||||||
client.ClientAvatar.SendAppearanceToOtherAgent(this);
|
client.ClientAvatar.SendAppearanceToOtherAgent(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OpenSim_Main.local_world.GetInitialPrims(this);
|
||||||
break;
|
break;
|
||||||
case PacketType.ObjectAdd:
|
case PacketType.ObjectAdd:
|
||||||
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
|
OpenSim_Main.local_world.AddNewPrim((ObjectAddPacket)Pack, this);
|
||||||
|
|
|
@ -169,9 +169,12 @@ namespace OpenSim
|
||||||
OpenSim.world.Avatar TempAv;
|
OpenSim.world.Avatar TempAv;
|
||||||
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
|
this.WriteLine(String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}","Firstname", "Lastname","Agent ID", "Session ID", "Circuit", "IP"));
|
||||||
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
|
foreach (libsecondlife.LLUUID UUID in OpenSim_Main.local_world.Entities.Keys) {
|
||||||
|
if(OpenSim_Main.local_world.Entities[UUID].ToString()== "OpenSim.world.Avatar")
|
||||||
|
{
|
||||||
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
|
TempAv=(OpenSim.world.Avatar)OpenSim_Main.local_world.Entities[UUID];
|
||||||
this.WriteLine(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()));
|
this.WriteLine(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()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace RemoteGridServers
|
||||||
|
|
||||||
public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
public bool LogoutSession(LLUUID sessionID, LLUUID agentID, uint circuitCode)
|
||||||
{
|
{
|
||||||
WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + circuitCode.ToString() + "/delete");
|
WebRequest DeleteSession = WebRequest.Create(GridServerUrl + "/usersessions/" + GridSendKey + "/" + agentID.ToString() + "/" + circuitCode.ToString() + "/delete");
|
||||||
WebResponse GridResponse = DeleteSession.GetResponse();
|
WebResponse GridResponse = DeleteSession.GetResponse();
|
||||||
StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
|
StreamReader sr = new StreamReader(GridResponse.GetResponseStream());
|
||||||
String grTest = sr.ReadLine();
|
String grTest = sr.ReadLine();
|
||||||
|
|
|
@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhysXplugin", "physics\plug
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerConsole", "ServerConsole\ServerConsole\ServerConsole.csproj", "{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Db4LocalStorage", "LocalStorage\Db4LocalStorage\Db4LocalStorage.csproj", "{74784F23-B0FD-484C-82C1-96C0215733DC}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|.NET 1.1 = Debug|.NET 1.1
|
Debug|.NET 1.1 = Debug|.NET 1.1
|
||||||
|
@ -89,6 +91,14 @@ Global
|
||||||
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
|
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
|
||||||
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C9A6026D-8E0C-4FE4-8691-FB2A566AA245}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|.NET 1.1.Build.0 = Debug|.NET 1.1
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|.NET 1.1.ActiveCfg = Debug|.NET 1.1
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Release|.NET 1.1.Build.0 = Release|.NET 1.1
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Release|.NET 1.1.ActiveCfg = Release|.NET 1.1
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{74784F23-B0FD-484C-82C1-96C0215733DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -58,5 +58,10 @@ namespace OpenSim.world
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void BackUp()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.Text;
|
||||||
using OpenSim.types;
|
using OpenSim.types;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
|
using GridInterfaces;
|
||||||
|
|
||||||
namespace OpenSim.world
|
namespace OpenSim.world
|
||||||
{
|
{
|
||||||
|
@ -69,6 +70,14 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
this.updateFlag = false;
|
this.updateFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateClient(OpenSimClient RemoteClient)
|
||||||
|
{
|
||||||
|
byte[] pb = this.position.GetBytes();
|
||||||
|
Array.Copy(pb, 0, OurPacket.ObjectData[0].ObjectData, 0, pb.Length);
|
||||||
|
RemoteClient.OutPacket(OurPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
public void CreateFromPacket( ObjectAddPacket addPacket, LLUUID agentID, uint localID)
|
||||||
|
@ -118,8 +127,7 @@ namespace OpenSim.world
|
||||||
//finish off copying rest of shape data
|
//finish off copying rest of shape data
|
||||||
|
|
||||||
objupdate.ObjectData[0].ID = (uint)(localID);
|
objupdate.ObjectData[0].ID = (uint)(localID);
|
||||||
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efefda" + (localID- 702000).ToString("000"));
|
objupdate.ObjectData[0].FullID = new LLUUID("edba7151-5857-acc5-b30b-f01efef" + (localID- 702000).ToString("00000"));
|
||||||
|
|
||||||
objupdate.ObjectData[0].ObjectData = new byte[60];
|
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||||
objupdate.ObjectData[0].ObjectData[46] = 128;
|
objupdate.ObjectData[0].ObjectData[46] = 128;
|
||||||
objupdate.ObjectData[0].ObjectData[47] = 63;
|
objupdate.ObjectData[0].ObjectData[47] = 63;
|
||||||
|
@ -135,6 +143,67 @@ namespace OpenSim.world
|
||||||
this.OurPacket = objupdate;
|
this.OurPacket = objupdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void CreateFromStorage(PrimStorage store)
|
||||||
|
{
|
||||||
|
//need to clean this up as it shares a lot of code with CreateFromPacket()
|
||||||
|
ObjectUpdatePacket objupdate = new ObjectUpdatePacket();
|
||||||
|
objupdate.RegionData.RegionHandle = OpenSim_Main.cfg.RegionHandle;
|
||||||
|
objupdate.RegionData.TimeDilation = 64096;
|
||||||
|
objupdate.ObjectData = new libsecondlife.Packets.ObjectUpdatePacket.ObjectDataBlock[1];
|
||||||
|
|
||||||
|
this.primData = store.Data;
|
||||||
|
objupdate.ObjectData[0] = new ObjectUpdatePacket.ObjectDataBlock();
|
||||||
|
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[0].ExtraParams = new byte[1];
|
||||||
|
objupdate.ObjectData[0].MediaURL = new byte[0];
|
||||||
|
objupdate.ObjectData[0].NameValue = new byte[0];
|
||||||
|
objupdate.ObjectData[0].PSBlock = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Text = new byte[0];
|
||||||
|
objupdate.ObjectData[0].TextColor = new byte[4];
|
||||||
|
objupdate.ObjectData[0].JointAxisOrAnchor = new LLVector3(0,0,0);
|
||||||
|
objupdate.ObjectData[0].JointPivot = new LLVector3(0,0,0);
|
||||||
|
objupdate.ObjectData[0].Material = 3;
|
||||||
|
objupdate.ObjectData[0].UpdateFlags=32+65536+131072+256+4+8+2048+524288+268435456;
|
||||||
|
objupdate.ObjectData[0].TextureAnim = new byte[0];
|
||||||
|
objupdate.ObjectData[0].Sound = LLUUID.Zero;
|
||||||
|
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-5005-000000000005"));
|
||||||
|
objupdate.ObjectData[0].TextureEntry = ntex.ToBytes();
|
||||||
|
objupdate.ObjectData[0].State = 0;
|
||||||
|
objupdate.ObjectData[0].Data = new byte[0];
|
||||||
|
objupdate.ObjectData[0].OwnerID = this.primData.OwnerID;
|
||||||
|
objupdate.ObjectData[0].PCode = this.primData.PCode;
|
||||||
|
objupdate.ObjectData[0].PathBegin = this.primData.PathBegin;
|
||||||
|
objupdate.ObjectData[0].PathEnd = this.primData.PathEnd;
|
||||||
|
objupdate.ObjectData[0].PathScaleX = this.primData.PathScaleX;
|
||||||
|
objupdate.ObjectData[0].PathScaleY = this.primData.PathScaleY;
|
||||||
|
objupdate.ObjectData[0].PathShearX = this.primData.PathShearX;
|
||||||
|
objupdate.ObjectData[0].PathShearY = this.primData.PathShearY;
|
||||||
|
objupdate.ObjectData[0].PathSkew = this.primData.PathSkew;
|
||||||
|
objupdate.ObjectData[0].ProfileBegin = this.primData.ProfileBegin;
|
||||||
|
objupdate.ObjectData[0].ProfileEnd = this.primData.ProfileEnd;
|
||||||
|
objupdate.ObjectData[0].Scale = this.primData.Scale;
|
||||||
|
objupdate.ObjectData[0].PathCurve = this.primData.PathCurve;
|
||||||
|
objupdate.ObjectData[0].ProfileCurve = this.primData.ProfileCurve;
|
||||||
|
objupdate.ObjectData[0].ParentID = 0;
|
||||||
|
objupdate.ObjectData[0].ProfileHollow = this.primData.ProfileHollow;
|
||||||
|
//finish off copying rest of shape data
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ID = (uint)store.LocalID;
|
||||||
|
objupdate.ObjectData[0].FullID = store.FullID;
|
||||||
|
|
||||||
|
objupdate.ObjectData[0].ObjectData = new byte[60];
|
||||||
|
objupdate.ObjectData[0].ObjectData[46] = 128;
|
||||||
|
objupdate.ObjectData[0].ObjectData[47] = 63;
|
||||||
|
LLVector3 pos1= store.Position;
|
||||||
|
//update position
|
||||||
|
byte[] pb = pos1.GetBytes();
|
||||||
|
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 0, pb.Length);
|
||||||
|
|
||||||
|
this.uuid = objupdate.ObjectData[0].FullID;
|
||||||
|
this.localid = objupdate.ObjectData[0].ID;
|
||||||
|
this.position = pos1;
|
||||||
|
this.OurPacket = objupdate;
|
||||||
|
}
|
||||||
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
|
public ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreateImprovedBlock()
|
||||||
{
|
{
|
||||||
uint ID = this.localid;
|
uint ID = this.localid;
|
||||||
|
@ -200,30 +269,17 @@ namespace OpenSim.world
|
||||||
dat.Data=bytes;
|
dat.Data=bytes;
|
||||||
return dat;
|
return dat;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public class PrimData
|
public override void BackUp()
|
||||||
{
|
|
||||||
public LLUUID OwnerID;
|
|
||||||
public byte PCode;
|
|
||||||
public byte PathBegin;
|
|
||||||
public byte PathEnd;
|
|
||||||
public byte PathScaleX;
|
|
||||||
public byte PathScaleY;
|
|
||||||
public byte PathShearX;
|
|
||||||
public byte PathShearY;
|
|
||||||
public sbyte PathSkew;
|
|
||||||
public byte ProfileBegin;
|
|
||||||
public byte ProfileEnd;
|
|
||||||
public LLVector3 Scale;
|
|
||||||
public byte PathCurve;
|
|
||||||
public byte ProfileCurve;
|
|
||||||
public uint ParentID=0;
|
|
||||||
public byte ProfileHollow;
|
|
||||||
|
|
||||||
public PrimData()
|
|
||||||
{
|
{
|
||||||
|
PrimStorage pStore = new PrimStorage();
|
||||||
|
pStore.Data = this.primData;
|
||||||
|
pStore.FullID = this.uuid;
|
||||||
|
pStore.LocalID = this.localid;
|
||||||
|
pStore.Position = this.position;
|
||||||
|
pStore.Rotation = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z , this.rotation.w);
|
||||||
|
OpenSim_Main.local_world.localStorage.StorePrim(pStore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,12 +3,14 @@ using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Reflection;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using PhysicsSystem;
|
using PhysicsSystem;
|
||||||
|
using GridInterfaces;
|
||||||
|
|
||||||
namespace OpenSim.world
|
namespace OpenSim.world
|
||||||
{
|
{
|
||||||
public class World
|
public class World : ILocalStorageReceiver
|
||||||
{
|
{
|
||||||
public Dictionary<libsecondlife.LLUUID, Entity> Entities;
|
public Dictionary<libsecondlife.LLUUID, Entity> Entities;
|
||||||
public float[] LandMap;
|
public float[] LandMap;
|
||||||
|
@ -17,9 +19,10 @@ namespace OpenSim.world
|
||||||
private PhysicsScene phyScene;
|
private PhysicsScene phyScene;
|
||||||
private float timeStep= 0.1f;
|
private float timeStep= 0.1f;
|
||||||
private libsecondlife.TerrainManager TerrainManager;
|
private libsecondlife.TerrainManager TerrainManager;
|
||||||
|
public ILocalStorage localStorage;
|
||||||
private Random Rand = new Random();
|
private Random Rand = new Random();
|
||||||
private uint _primCount = 702000;
|
private uint _primCount = 702000;
|
||||||
|
private int storageCount;
|
||||||
|
|
||||||
public World()
|
public World()
|
||||||
{
|
{
|
||||||
|
@ -48,7 +51,6 @@ namespace OpenSim.world
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
|
||||||
if(this.phyScene.IsThreaded)
|
if(this.phyScene.IsThreaded)
|
||||||
{
|
{
|
||||||
this.phyScene.GetResults();
|
this.phyScene.GetResults();
|
||||||
|
@ -66,6 +68,66 @@ namespace OpenSim.world
|
||||||
{
|
{
|
||||||
Entities[UUID].update();
|
Entities[UUID].update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//backup world data
|
||||||
|
this.storageCount++;
|
||||||
|
if(storageCount> 1200) //set to how often you want to backup (currently set for about every 2 minutes)
|
||||||
|
{
|
||||||
|
this.Backup();
|
||||||
|
storageCount =0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LoadStorageDLL(string dllName)
|
||||||
|
{
|
||||||
|
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
|
||||||
|
ILocalStorage store = null;
|
||||||
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
|
{
|
||||||
|
if (pluginType.IsPublic)
|
||||||
|
{
|
||||||
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
|
Type typeInterface = pluginType.GetInterface("ILocalStorage", true);
|
||||||
|
|
||||||
|
if (typeInterface != null)
|
||||||
|
{
|
||||||
|
ILocalStorage plug = (ILocalStorage)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
store = plug;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
typeInterface = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pluginAssembly = null;
|
||||||
|
this.localStorage = store;
|
||||||
|
return(store == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadPrimsFromStorage()
|
||||||
|
{
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("World.cs: LoadPrimsFromStorage() - Loading primitives");
|
||||||
|
this.localStorage.LoadPrimitives(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PrimFromStorage(PrimStorage prim)
|
||||||
|
{
|
||||||
|
if(prim.LocalID >= this._primCount)
|
||||||
|
{
|
||||||
|
_primCount = prim.LocalID + 1;
|
||||||
|
}
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("World.cs: PrimFromStorage() - Reloading prim (localId "+ prim.LocalID+ " ) from storage");
|
||||||
|
Primitive nPrim = new Primitive();
|
||||||
|
nPrim.CreateFromStorage(prim);
|
||||||
|
this.Entities.Add(nPrim.uuid, nPrim);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
this.localStorage.ShutDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLayerData(OpenSimClient RemoteClient) {
|
public void SendLayerData(OpenSimClient RemoteClient) {
|
||||||
|
@ -86,6 +148,17 @@ namespace OpenSim.world
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GetInitialPrims(OpenSimClient RemoteClient)
|
||||||
|
{
|
||||||
|
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||||
|
{
|
||||||
|
if(Entities[UUID].ToString()== "OpenSim.world.Primitive")
|
||||||
|
{
|
||||||
|
((OpenSim.world.Primitive)Entities[UUID]).UpdateClient(RemoteClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddViewerAgent(OpenSimClient AgentClient) {
|
public void AddViewerAgent(OpenSimClient AgentClient) {
|
||||||
ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
ServerConsole.MainConsole.Instance.WriteLine("World.cs:AddViewerAgent() - Creating new avatar for remote viewer agent");
|
||||||
Avatar NewAvatar = new Avatar(AgentClient);
|
Avatar NewAvatar = new Avatar(AgentClient);
|
||||||
|
@ -109,8 +182,12 @@ namespace OpenSim.world
|
||||||
|
|
||||||
public bool Backup() {
|
public bool Backup() {
|
||||||
/* TODO: Save the current world entities state. */
|
/* TODO: Save the current world entities state. */
|
||||||
|
ServerConsole.MainConsole.Instance.WriteLine("World.cs: Backup() - Backing up Primitives");
|
||||||
return false;
|
foreach (libsecondlife.LLUUID UUID in Entities.Keys)
|
||||||
|
{
|
||||||
|
Entities[UUID].BackUp();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue