The regionUUID is now being passed to the datastore calls.

afrisby
MW 2007-08-20 15:49:06 +00:00
parent 4af33c4da6
commit 31a81e17be
9 changed files with 65 additions and 34 deletions

View File

@ -40,8 +40,8 @@ using OpenSim.Framework.Inventory;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Communications.Caches;
using Timer=System.Timers.Timer; using Timer = System.Timers.Timer;
namespace OpenSim.Region.ClientStack namespace OpenSim.Region.ClientStack
{ {
@ -74,7 +74,7 @@ namespace OpenSim.Region.ClientStack
protected IScene m_scene; protected IScene m_scene;
private Dictionary<uint, ClientView> m_clientThreads; private Dictionary<uint, ClientView> m_clientThreads;
private AssetCache m_assetCache; private AssetCache m_assetCache;
// private InventoryCache m_inventoryCache; // private InventoryCache m_inventoryCache;
private int cachedtextureserial = 0; private int cachedtextureserial = 0;
protected AgentCircuitManager m_authenticateSessionsHandler; protected AgentCircuitManager m_authenticateSessionsHandler;
private Encoding enc = Encoding.ASCII; private Encoding enc = Encoding.ASCII;
@ -84,7 +84,7 @@ namespace OpenSim.Region.ClientStack
private int probesWithNoIngressPackets = 0; private int probesWithNoIngressPackets = 0;
private int lastPacketsReceived = 0; private int lastPacketsReceived = 0;
public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions ) public ClientView(EndPoint remoteEP, UseCircuitCodePacket initialcirpack, Dictionary<uint, ClientView> clientThreads, IScene scene, AssetCache assetCache, PacketServer packServer, AgentCircuitManager authenSessions)
{ {
m_moneyBalance = 1000; m_moneyBalance = 1000;
@ -93,10 +93,10 @@ namespace OpenSim.Region.ClientStack
m_assetCache = assetCache; m_assetCache = assetCache;
m_networkServer = packServer; m_networkServer = packServer;
// m_inventoryCache = inventoryCache; // m_inventoryCache = inventoryCache;
m_authenticateSessionsHandler = authenSessions; m_authenticateSessionsHandler = authenSessions;
MainLog.Instance.Verbose( "OpenSimClient.cs - Started up new client thread to handle incoming request"); MainLog.Instance.Verbose("OpenSimClient.cs - Started up new client thread to handle incoming request");
cirpack = initialcirpack; cirpack = initialcirpack;
userEP = remoteEP; userEP = remoteEP;
@ -121,7 +121,7 @@ namespace OpenSim.Region.ClientStack
public void KillClient() public void KillClient()
{ {
clientPingTimer.Stop(); clientPingTimer.Stop();
m_scene.RemoveClient(this.AgentId); m_scene.RemoveClient(this.AgentId);
m_clientThreads.Remove(this.CircuitCode); m_clientThreads.Remove(this.CircuitCode);
@ -186,14 +186,15 @@ namespace OpenSim.Region.ClientStack
protected virtual void ClientLoop() protected virtual void ClientLoop()
{ {
MainLog.Instance.Verbose( "OpenSimClient.cs:ClientLoop() - Entered loop"); MainLog.Instance.Verbose("OpenSimClient.cs:ClientLoop() - Entered loop");
while (true) while (true)
{ {
QueItem nextPacket = PacketQueue.Dequeue(); QueItem nextPacket = PacketQueue.Dequeue();
if (nextPacket.Incoming) if (nextPacket.Incoming)
{ {
//is a incoming packet //is a incoming packet
if (nextPacket.Packet.Type != PacketType.AgentUpdate) { if (nextPacket.Packet.Type != PacketType.AgentUpdate)
{
packetsReceived++; packetsReceived++;
} }
ProcessInPacket(nextPacket.Packet); ProcessInPacket(nextPacket.Packet);
@ -209,15 +210,21 @@ namespace OpenSim.Region.ClientStack
protected void CheckClientConnectivity(object sender, ElapsedEventArgs e) protected void CheckClientConnectivity(object sender, ElapsedEventArgs e)
{ {
if (packetsReceived == lastPacketsReceived) { if (packetsReceived == lastPacketsReceived)
{
probesWithNoIngressPackets++; probesWithNoIngressPackets++;
if (probesWithNoIngressPackets > 30) { if (probesWithNoIngressPackets > 30)
{
this.KillClient(); this.KillClient();
} else { }
else
{
// this will normally trigger at least one packet (ping response) // this will normally trigger at least one packet (ping response)
SendStartPingCheck(0); SendStartPingCheck(0);
} }
} else { }
else
{
// Something received in the meantime - we can reset the counters // Something received in the meantime - we can reset the counters
probesWithNoIngressPackets = 0; probesWithNoIngressPackets = 0;
lastPacketsReceived = packetsReceived; lastPacketsReceived = packetsReceived;
@ -232,7 +239,7 @@ namespace OpenSim.Region.ClientStack
clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity); clientPingTimer.Elapsed += new ElapsedEventHandler(CheckClientConnectivity);
clientPingTimer.Enabled = true; clientPingTimer.Enabled = true;
MainLog.Instance.Verbose( "OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene"); MainLog.Instance.Verbose("OpenSimClient.cs:InitNewClient() - Adding viewer agent to scene");
this.m_scene.AddNewClient(this, false); this.m_scene.AddNewClient(this, false);
} }

View File

@ -47,10 +47,10 @@ namespace OpenSim.Region.Interfaces
/// <param name="dbname">The name of the database to store to (may not be applicable)</param> /// <param name="dbname">The name of the database to store to (may not be applicable)</param>
void Initialise(string filename, string dbname); void Initialise(string filename, string dbname);
void StoreObject(SceneObjectGroup obj); void StoreObject(SceneObjectGroup obj, LLUUID regionUUID);
void RemoveObject(LLUUID uuid); void RemoveObject(LLUUID uuid, LLUUID regionUUID);
List<SceneObjectGroup> LoadObjects(); List<SceneObjectGroup> LoadObjects(LLUUID regionUUID);
void StoreTerrain(double[,] terrain); void StoreTerrain(double[,] terrain);
double[,] LoadTerrain(); double[,] LoadTerrain();

View File

@ -270,7 +270,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendInventoryItemUpdate(item); remoteClient.SendInventoryItemUpdate(item);
} }
storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID); storageManager.DataStore.RemoveObject(((SceneObjectGroup)selectedEnt).UUID, m_regInfo.SimUUID);
((SceneObjectGroup)selectedEnt).DeleteGroup(); ((SceneObjectGroup)selectedEnt).DeleteGroup();
lock (Entities) lock (Entities)

View File

@ -180,6 +180,8 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence.LoadAnims(); ScenePresence.LoadAnims();
httpListener = httpServer; httpListener = httpServer;
} }
#endregion #endregion
@ -497,7 +499,7 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadPrimsFromStorage() public void LoadPrimsFromStorage()
{ {
MainLog.Instance.Verbose("Loading objects from datastore"); MainLog.Instance.Verbose("Loading objects from datastore");
List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(); List<SceneObjectGroup> PrimsFromDB = storageManager.DataStore.LoadObjects(this.m_regInfo.SimUUID);
foreach (SceneObjectGroup prim in PrimsFromDB) foreach (SceneObjectGroup prim in PrimsFromDB)
{ {
AddEntityFromStorage(prim); AddEntityFromStorage(prim);
@ -707,7 +709,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory; client.OnFetchInventory += commsManager.UserProfiles.HandleFetchInventory;
client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest; client.OnAssetUploadRequest += commsManager.TransactionsManager.HandleUDPUploadRequest;
client.OnXferReceive += commsManager.TransactionsManager.HandleXfer; client.OnXferReceive += commsManager.TransactionsManager.HandleXfer;
// client.OnRequestXfer += RequestXfer; // client.OnRequestXfer += RequestXfer;
client.OnRequestAvatarProperties += RequestAvatarProperty; client.OnRequestAvatarProperties += RequestAvatarProperty;
@ -919,9 +921,7 @@ namespace OpenSim.Region.Environment.Scenes
if (agent.CapsPath != "") if (agent.CapsPath != "")
{ {
//Console.WriteLine("new user, so creating caps handler for it"); //Console.WriteLine("new user, so creating caps handler for it");
Caps cap = Caps cap = new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port, agent.CapsPath, agent.AgentID);
new Caps(assetCache, httpListener, m_regInfo.ExternalHostName, m_regInfo.ExternalEndPoint.Port,
agent.CapsPath, agent.AgentID);
Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/"); Util.SetCapsURL(agent.AgentID, "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "/CAPS/" + agent.CapsPath + "0000/");
cap.RegisterHandlers(); cap.RegisterHandlers();
cap.AddNewInventoryItem = this.AddInventoryItem; cap.AddNewInventoryItem = this.AddInventoryItem;

View File

@ -436,12 +436,26 @@ namespace OpenSim.Region.Environment.Scenes
linkPart.SetParent(this); linkPart.SetParent(this);
//TODO: rest of parts //TODO: rest of parts
foreach (SceneObjectPart part in objectGroup.Children.Values)
{
if (part.UUID != objectGroup.m_rootPart.UUID)
{
this.LinkNonRootPart(part);
}
}
m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup; m_scene.EventManager.OnBackup -= objectGroup.ProcessBackup;
m_scene.DeleteEntity(objectGroup.UUID); m_scene.DeleteEntity(objectGroup.UUID);
this.ScheduleGroupForFullUpdate(); this.ScheduleGroupForFullUpdate();
} }
private void LinkNonRootPart(SceneObjectPart part)
{
part.SetParent(this);
part.ParentID = this.m_rootPart.LocalID;
this.m_parts.Add(part.UUID, part);
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -812,7 +826,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="datastore"></param> /// <param name="datastore"></param>
public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore) public void ProcessBackup(OpenSim.Region.Interfaces.IRegionDataStore datastore)
{ {
datastore.StoreObject(this); datastore.StoreObject(this, m_scene.RegionInfo.SimUUID);
} }
#endregion #endregion

View File

@ -496,6 +496,16 @@ namespace OpenSim.Region.Environment.Scenes
this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
this.ControllingClient.SendViewerTime(this.m_scene.TimePhase); this.ControllingClient.SendViewerTime(this.m_scene.TimePhase);
//Please don't remove the following code (at least not yet), just leave it commented out
//gives the user god powers, should help with debuging things in the future
/*
GrantGodlikePowersPacket grant = new GrantGodlikePowersPacket();
grant.AgentData.AgentID = this.ControllingClient.AgentId;
grant.AgentData.SessionID = this.ControllingClient.SessionId;
grant.GrantData.GodLevel = 255;
grant.GrantData.Token = LLUUID.Random();
this.ControllingClient.OutPacket(grant);*/
} }
/// <summary> /// <summary>

View File

@ -43,12 +43,12 @@ namespace OpenSim.DataStore.DB4oStorage
return; return;
} }
public void StoreObject(SceneObjectGroup obj) public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{ {
db.Set(obj); db.Set(obj);
} }
public void RemoveObject(LLUUID obj) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
IObjectSet result = db.Query(new SceneObjectQuery(obj)); IObjectSet result = db.Query(new SceneObjectQuery(obj));
if (result.Count > 0) if (result.Count > 0)
@ -58,7 +58,7 @@ namespace OpenSim.DataStore.DB4oStorage
} }
} }
public List<SceneObjectGroup> LoadObjects() public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {
IObjectSet result = db.Get(typeof(SceneObjectGroup)); IObjectSet result = db.Get(typeof(SceneObjectGroup));
List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); List<SceneObjectGroup> retvals = new List<SceneObjectGroup>();

View File

@ -485,7 +485,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
} }
} }
public void StoreObject(SceneObjectGroup obj) public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{ {
foreach (SceneObjectPart prim in obj.Children.Values) foreach (SceneObjectPart prim in obj.Children.Values)
{ {
@ -498,7 +498,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
// MainLog.Instance.Verbose("Dump of prims:", ds.GetXml()); // MainLog.Instance.Verbose("Dump of prims:", ds.GetXml());
} }
public void RemoveObject(LLUUID obj) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
DataTable prims = ds.Tables["prims"]; DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"]; DataTable shapes = ds.Tables["primshapes"];
@ -520,7 +520,7 @@ namespace OpenSim.DataStore.MonoSqliteStorage
shapeDa.Update(ds, "primshapes"); shapeDa.Update(ds, "primshapes");
} }
public List<SceneObjectGroup> LoadObjects() public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {
Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>(); Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
List<SceneObjectGroup> retvals = new List<SceneObjectGroup>(); List<SceneObjectGroup> retvals = new List<SceneObjectGroup>();

View File

@ -18,17 +18,17 @@ namespace OpenSim.DataStore.NullStorage
return; return;
} }
public void StoreObject(SceneObjectGroup obj) public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{ {
} }
public void RemoveObject(LLUUID obj) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
} }
public List<SceneObjectGroup> LoadObjects() public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {
return new List<SceneObjectGroup>(); return new List<SceneObjectGroup>();
} }