Local Asset server (and cache) should now work correctly.
Newly created assets are saved in the local asset cache. Can now upload small images from the viewer (currently the images have to be under about 1KB and these are only backed up in the asset server when in sandbox mode).zircon
parent
7c25436a70
commit
5f97ed652a
|
@ -80,7 +80,12 @@ namespace OpenSim.GridInterfaces.Local
|
||||||
|
|
||||||
public void UploadNewAsset(AssetBase asset)
|
public void UploadNewAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
|
AssetStorage store = new AssetStorage();
|
||||||
|
store.Data = asset.Data;
|
||||||
|
store.Name = asset.Name;
|
||||||
|
store.UUID = asset.FullID;
|
||||||
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetServerInfo(string ServerUrl, string ServerKey)
|
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||||
|
@ -156,9 +161,10 @@ namespace OpenSim.GridInterfaces.Local
|
||||||
db.Set(store);
|
db.Set(store);
|
||||||
db.Commit();
|
db.Commit();
|
||||||
|
|
||||||
|
Image = new AssetBase();
|
||||||
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||||
Image.Name = "Prim Base Texture";
|
Image.Name = "Prim Base Texture";
|
||||||
|
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||||
store = new AssetStorage();
|
store = new AssetStorage();
|
||||||
store.Data = Image.Data;
|
store.Data = Image.Data;
|
||||||
store.Name = Image.Name;
|
store.Name = Image.Name;
|
||||||
|
@ -185,7 +191,7 @@ namespace OpenSim.GridInterfaces.Local
|
||||||
//should request Asset from storage manager
|
//should request Asset from storage manager
|
||||||
//but for now read from file
|
//but for now read from file
|
||||||
|
|
||||||
string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Assets"); //+ folder;
|
string dataPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "assets"); //+ folder;
|
||||||
string fileName = Path.Combine(dataPath, filename);
|
string fileName = Path.Combine(dataPath, filename);
|
||||||
FileInfo fInfo = new FileInfo(fileName);
|
FileInfo fInfo = new FileInfo(fileName);
|
||||||
long numBytes = fInfo.Length;
|
long numBytes = fInfo.Length;
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace OpenSim.GridInterfaces.Remote
|
||||||
user.LoginInfo = new Login();
|
user.LoginInfo = new Login();
|
||||||
user.LoginInfo.Agent = agentID;
|
user.LoginInfo.Agent = agentID;
|
||||||
user.LoginInfo.Session = sessionID;
|
user.LoginInfo.Session = sessionID;
|
||||||
|
user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
|
||||||
user.LoginInfo.First = validcircuit.firstname;
|
user.LoginInfo.First = validcircuit.firstname;
|
||||||
user.LoginInfo.Last = validcircuit.lastname;
|
user.LoginInfo.Last = validcircuit.lastname;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ using libsecondlife.Packets;
|
||||||
using OpenSim;
|
using OpenSim;
|
||||||
using OpenSim.Framework.Interfaces;
|
using OpenSim.Framework.Interfaces;
|
||||||
using OpenSim.Framework.Assets;
|
using OpenSim.Framework.Assets;
|
||||||
|
using OpenSim.Framework.Utilities;
|
||||||
|
|
||||||
namespace OpenSim.Assets
|
namespace OpenSim.Assets
|
||||||
{
|
{
|
||||||
|
@ -50,7 +51,7 @@ namespace OpenSim.Assets
|
||||||
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
|
public Dictionary<LLUUID, AssetRequest> RequestedAssets = new Dictionary<LLUUID, AssetRequest>(); //Assets requested from the asset server
|
||||||
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
|
public Dictionary<LLUUID, AssetRequest> RequestedTextures = new Dictionary<LLUUID, AssetRequest>(); //Textures requested from the asset server
|
||||||
|
|
||||||
private Dictionary<libsecondlife.LLUUID, AssetBase> IncomingAssets;
|
//private Dictionary<libsecondlife.LLUUID, AssetBase> IncomingAssets;
|
||||||
|
|
||||||
private IAssetServer _assetServer;
|
private IAssetServer _assetServer;
|
||||||
private Thread _assetCacheThread;
|
private Thread _assetCacheThread;
|
||||||
|
@ -66,7 +67,7 @@ namespace OpenSim.Assets
|
||||||
_assetServer.SetReceiver(this);
|
_assetServer.SetReceiver(this);
|
||||||
Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
|
Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
|
||||||
Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
|
Textures = new Dictionary<libsecondlife.LLUUID, TextureImage>();
|
||||||
IncomingAssets = new Dictionary<libsecondlife.LLUUID, AssetBase>();
|
//IncomingAssets = new Dictionary<libsecondlife.LLUUID, AssetBase>();
|
||||||
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
this._assetCacheThread = new Thread(new ThreadStart(RunAssetManager));
|
||||||
this._assetCacheThread.IsBackground = true;
|
this._assetCacheThread.IsBackground = true;
|
||||||
this._assetCacheThread.Start();
|
this._assetCacheThread.Start();
|
||||||
|
@ -82,9 +83,10 @@ namespace OpenSim.Assets
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//Console.WriteLine("Asset cache loop");
|
||||||
this.ProcessAssetQueue();
|
this.ProcessAssetQueue();
|
||||||
this.ProcessTextureQueue();
|
this.ProcessTextureQueue();
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(500);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -115,6 +117,7 @@ namespace OpenSim.Assets
|
||||||
inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
|
inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
|
||||||
TextureImage image = new TextureImage(inventorySet[i]);
|
TextureImage image = new TextureImage(inventorySet[i]);
|
||||||
this.Textures.Add(image.FullID, image);
|
this.Textures.Add(image.FullID, image);
|
||||||
|
this._assetServer.UploadNewAsset(image); //save the asset to the asset server
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return inventorySet;
|
return inventorySet;
|
||||||
|
@ -142,9 +145,14 @@ namespace OpenSim.Assets
|
||||||
num = 5;
|
num = 5;
|
||||||
}
|
}
|
||||||
AssetRequest req;
|
AssetRequest req;
|
||||||
|
Console.WriteLine("processing texture requests ( " + num + " )");
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
req = (AssetRequest)this.TextureRequests[i];
|
req = (AssetRequest)this.TextureRequests[i];
|
||||||
|
if (req.PacketCounter != req.NumPackets)
|
||||||
|
{
|
||||||
|
// if (req.ImageInfo.FullID == new LLUUID("00000000-0000-0000-5005-000000000005"))
|
||||||
|
Console.WriteLine("sending base texture ( " + req.ImageInfo.FullID + " ) in " + req.NumPackets + "number of packets");
|
||||||
|
|
||||||
if (req.PacketCounter == 0)
|
if (req.PacketCounter == 0)
|
||||||
{
|
{
|
||||||
|
@ -196,10 +204,13 @@ namespace OpenSim.Assets
|
||||||
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//remove requests that have been completed
|
//remove requests that have been completed
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
|
{
|
||||||
|
if (this.TextureRequests.Count > count)
|
||||||
{
|
{
|
||||||
req = (AssetRequest)this.TextureRequests[count];
|
req = (AssetRequest)this.TextureRequests[count];
|
||||||
if (req.PacketCounter == req.NumPackets)
|
if (req.PacketCounter == req.NumPackets)
|
||||||
|
@ -211,11 +222,12 @@ namespace OpenSim.Assets
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public void AssetReceived(AssetBase asset, bool IsTexture)
|
public void AssetReceived(AssetBase asset, bool IsTexture)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("received asset from asset server ( " + asset.FullID + " )");
|
||||||
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
if (asset.FullID != LLUUID.Zero) // if it is set to zero then the asset wasn't found by the server
|
||||||
{
|
{
|
||||||
//check if it is a texture or not
|
//check if it is a texture or not
|
||||||
|
@ -230,6 +242,15 @@ namespace OpenSim.Assets
|
||||||
{
|
{
|
||||||
AssetRequest req = this.RequestedTextures[image.FullID];
|
AssetRequest req = this.RequestedTextures[image.FullID];
|
||||||
req.ImageInfo = image;
|
req.ImageInfo = image;
|
||||||
|
if (image.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(image.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
this.RequestedTextures.Remove(image.FullID);
|
this.RequestedTextures.Remove(image.FullID);
|
||||||
this.TextureRequests.Add(req);
|
this.TextureRequests.Add(req);
|
||||||
}
|
}
|
||||||
|
@ -242,6 +263,15 @@ namespace OpenSim.Assets
|
||||||
{
|
{
|
||||||
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
||||||
req.AssetInf = assetInf;
|
req.AssetInf = assetInf;
|
||||||
|
if (assetInf.Data.LongLength > 600)
|
||||||
|
{
|
||||||
|
//over 600 bytes so split up file
|
||||||
|
req.NumPackets = 1 + (int)(assetInf.Data.Length - 600 + 999) / 1000;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
req.NumPackets = 1;
|
||||||
|
}
|
||||||
this.RequestedAssets.Remove(assetInf.FullID);
|
this.RequestedAssets.Remove(assetInf.FullID);
|
||||||
this.AssetRequests.Add(req);
|
this.AssetRequests.Add(req);
|
||||||
}
|
}
|
||||||
|
@ -403,6 +433,9 @@ namespace OpenSim.Assets
|
||||||
/// <param name="imageID"></param>
|
/// <param name="imageID"></param>
|
||||||
public void AddTextureRequest(SimClient userInfo, LLUUID imageID)
|
public void AddTextureRequest(SimClient userInfo, LLUUID imageID)
|
||||||
{
|
{
|
||||||
|
if (imageID == new LLUUID("00000000-0000-0000-5005-000000000005"))
|
||||||
|
Console.WriteLine("request base prim texture ");
|
||||||
|
|
||||||
//check to see if texture is in local cache, if not request from asset server
|
//check to see if texture is in local cache, if not request from asset server
|
||||||
if (!this.Textures.ContainsKey(imageID))
|
if (!this.Textures.ContainsKey(imageID))
|
||||||
{
|
{
|
||||||
|
@ -452,31 +485,27 @@ namespace OpenSim.Assets
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region viewer asset uploading
|
#region viewer asset uploading
|
||||||
/* public AssetBase UploadPacket(AssetUploadRequestPacket pack)
|
public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
|
||||||
{
|
{
|
||||||
|
|
||||||
AssetBase asset = null;
|
AssetBase asset = null;
|
||||||
if(this.IncomingAssets.ContainsKey(pack.AssetBlock.TransactionID))
|
if (pack.AssetBlock.Type == 0)
|
||||||
{
|
{
|
||||||
// not the first packet of this transaction
|
if (pack.AssetBlock.AssetData.Length > 0)
|
||||||
asset = this.IncomingAssets[pack.AssetBlock.TransactionID];
|
|
||||||
byte[] idata = new byte[asset.Data.Length + pack.AssetBlock.AssetData.Length];
|
|
||||||
Array.Copy(asset.Data, 0, idata, 0, asset.Data.Length);
|
|
||||||
Array.Copy(pack.AssetBlock.AssetData, 0, idata, asset.Data.Length, pack.AssetBlock.AssetData.Length);
|
|
||||||
asset.Data = idata;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
//first packet for transaction
|
//first packet for transaction
|
||||||
asset = new AssetBase();
|
asset = new AssetBase();
|
||||||
asset.FullID = LLUUID.Random();
|
asset.FullID = assetID;
|
||||||
asset.Type = pack.AssetBlock.Type;
|
asset.Type = pack.AssetBlock.Type;
|
||||||
asset.InvType = asset.Type;
|
asset.InvType = asset.Type;
|
||||||
|
asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
|
||||||
asset.Data = pack.AssetBlock.AssetData;
|
asset.Data = pack.AssetBlock.AssetData;
|
||||||
//this.IncomingAssets.Add(pack.AssetBlock.TransactionID,asset);
|
this._assetServer.UploadNewAsset(asset);
|
||||||
TextureImage image = new TextureImage(asset);
|
TextureImage image = new TextureImage(asset);
|
||||||
this.Textures.Add(image.FullID, image);
|
this.Textures.Add(image.FullID, image);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,29 +49,10 @@ using OpenSim.Physics.Manager;
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of MainForm.
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OpenSimMain : OpenSimApplication
|
public class OpenSimMain : OpenSimApplication
|
||||||
{
|
{
|
||||||
/* private static OpenSimRoot instance = null;
|
|
||||||
|
|
||||||
public static OpenSimRoot Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public World LocalWorld;
|
|
||||||
public Grid GridServers;
|
|
||||||
public SimConfig Cfg;
|
|
||||||
public SimCAPSHTTPServer HttpServer;
|
|
||||||
public AssetCache AssetCache;
|
|
||||||
public InventoryCache InventoryCache;
|
|
||||||
public Dictionary<EndPoint, SimClient> ClientThreads = new Dictionary<EndPoint, SimClient>();
|
|
||||||
public DateTime startuptime;
|
|
||||||
*/
|
|
||||||
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
private Dictionary<EndPoint, uint> clientCircuits = new Dictionary<EndPoint, uint>();
|
||||||
private PhysicsManager physManager;
|
private PhysicsManager physManager;
|
||||||
|
|
||||||
|
@ -84,7 +65,7 @@ namespace OpenSim
|
||||||
private AsyncCallback ReceivedData;
|
private AsyncCallback ReceivedData;
|
||||||
|
|
||||||
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
private System.Timers.Timer timer1 = new System.Timers.Timer();
|
||||||
private string ConfigDll = "OpenSim.Config.SimConfigDb4o.dll";
|
private string ConfigDll = "SimConfig.dll";
|
||||||
private string _physicsEngine = "basicphysics";
|
private string _physicsEngine = "basicphysics";
|
||||||
public bool sandbox = false;
|
public bool sandbox = false;
|
||||||
public bool loginserver = false;
|
public bool loginserver = false;
|
||||||
|
@ -123,18 +104,19 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OpenSimRoot.Instance.GridServers = new Grid();
|
OpenSimRoot.Instance.GridServers = new Grid();
|
||||||
if (sim.sandbox)
|
if (sim.sandbox)
|
||||||
{
|
{
|
||||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
|
OpenSimRoot.Instance.GridServers.AssetDll = "LocalGridServers.dll";
|
||||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
|
OpenSimRoot.Instance.GridServers.GridDll = "LocalGridServers.dll";
|
||||||
OpenSimRoot.Instance.GridServers.Initialise();
|
OpenSimRoot.Instance.GridServers.Initialise();
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
|
OpenSimRoot.Instance.GridServers.AssetDll = "RemoteGridServers.dll";
|
||||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
|
OpenSimRoot.Instance.GridServers.GridDll = "RemoteGridServers.dll";
|
||||||
OpenSimRoot.Instance.GridServers.Initialise();
|
OpenSimRoot.Instance.GridServers.Initialise();
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Grid mode");
|
||||||
}
|
}
|
||||||
|
@ -144,8 +126,6 @@ namespace OpenSim
|
||||||
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer);
|
LoginServer loginServer = new LoginServer(OpenSimRoot.Instance.GridServers.GridServer);
|
||||||
loginServer.Startup();
|
loginServer.Startup();
|
||||||
}
|
}
|
||||||
OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
|
|
||||||
OpenSimRoot.Instance.InventoryCache = new InventoryCache();
|
|
||||||
|
|
||||||
OpenSimRoot.Instance.StartUp();
|
OpenSimRoot.Instance.StartUp();
|
||||||
|
|
||||||
|
@ -163,6 +143,9 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
OpenSimRoot.Instance.startuptime = DateTime.Now;
|
OpenSimRoot.Instance.startuptime = DateTime.Now;
|
||||||
|
|
||||||
|
OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
|
||||||
|
OpenSimRoot.Instance.InventoryCache = new InventoryCache();
|
||||||
|
|
||||||
// We check our local database first, then the grid for config options
|
// We check our local database first, then the grid for config options
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||||
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
|
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||||
|
@ -177,6 +160,7 @@ namespace OpenSim
|
||||||
|
|
||||||
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||||
this.physManager.LoadPlugins();
|
this.physManager.LoadPlugins();
|
||||||
|
|
||||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Starting up messaging system");
|
||||||
OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
|
OpenSimRoot.Instance.LocalWorld.PhysScene = this.physManager.GetPhysicsScene(this._physicsEngine); //should be reading from the config file what physics engine to use
|
||||||
OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap);
|
OpenSimRoot.Instance.LocalWorld.PhysScene.SetTerrain(OpenSimRoot.Instance.LocalWorld.LandMap);
|
||||||
|
@ -184,7 +168,7 @@ namespace OpenSim
|
||||||
OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey);
|
OpenSimRoot.Instance.GridServers.AssetServer.SetServerInfo(OpenSimRoot.Instance.Cfg.AssetURL, OpenSimRoot.Instance.Cfg.AssetSendKey);
|
||||||
OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey);
|
OpenSimRoot.Instance.GridServers.GridServer.SetServerInfo(OpenSimRoot.Instance.Cfg.GridURL, OpenSimRoot.Instance.Cfg.GridSendKey, OpenSimRoot.Instance.Cfg.GridRecvKey);
|
||||||
|
|
||||||
OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("OpenSim.Storage.LocalStorageDb4o.dll"); //all these dll names shouldn't be hard coded.
|
OpenSimRoot.Instance.LocalWorld.LoadStorageDLL("Db4LocalStorage.dll"); //all these dll names shouldn't be hard coded.
|
||||||
OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage();
|
OpenSimRoot.Instance.LocalWorld.LoadPrimsFromStorage();
|
||||||
|
|
||||||
if (this.sandbox)
|
if (this.sandbox)
|
||||||
|
@ -241,6 +225,8 @@ namespace OpenSim
|
||||||
|
|
||||||
// This is either a new client or a packet to send to an old one
|
// This is either a new client or a packet to send to an old one
|
||||||
// if (OpenSimRoot.Instance.ClientThreads.ContainsKey(epSender))
|
// if (OpenSimRoot.Instance.ClientThreads.ContainsKey(epSender))
|
||||||
|
|
||||||
|
// do we already have a circuit for this endpoint
|
||||||
if(this.clientCircuits.ContainsKey(epSender))
|
if(this.clientCircuits.ContainsKey(epSender))
|
||||||
{
|
{
|
||||||
OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
|
OpenSimRoot.Instance.ClientThreads[this.clientCircuits[epSender]].InPacket(packet);
|
||||||
|
@ -282,6 +268,7 @@ namespace OpenSim
|
||||||
|
|
||||||
public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
|
public override void SendPacketTo(byte[] buffer, int size, SocketFlags flags, uint circuitcode )//EndPoint packetSender)
|
||||||
{
|
{
|
||||||
|
// find the endpoint for this circuit
|
||||||
EndPoint sendto = null;
|
EndPoint sendto = null;
|
||||||
foreach(KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
foreach(KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
||||||
{
|
{
|
||||||
|
@ -293,6 +280,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
if (sendto != null)
|
if (sendto != null)
|
||||||
{
|
{
|
||||||
|
//we found the endpoint so send the packet to it
|
||||||
this.Server.SendTo(buffer, size, flags, sendto);
|
this.Server.SendTo(buffer, size, flags, sendto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,7 +312,6 @@ namespace OpenSim
|
||||||
|
|
||||||
void Timer1Tick(object sender, System.EventArgs e)
|
void Timer1Tick(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
OpenSimRoot.Instance.LocalWorld.Update();
|
OpenSimRoot.Instance.LocalWorld.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@ using OpenSim.Physics.Manager;
|
||||||
|
|
||||||
namespace OpenSim
|
namespace OpenSim
|
||||||
{
|
{
|
||||||
public class OpenSimRoot
|
public sealed class OpenSimRoot
|
||||||
{
|
{
|
||||||
private static OpenSimRoot instance = new OpenSimRoot(); //null;
|
private static OpenSimRoot instance = new OpenSimRoot();
|
||||||
|
|
||||||
public static OpenSimRoot Instance
|
public static OpenSimRoot Instance
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim
|
||||||
|
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
public LLUUID SessionID;
|
public LLUUID SessionID;
|
||||||
|
public LLUUID SecureSessionID = LLUUID.Zero;
|
||||||
public uint CircuitCode;
|
public uint CircuitCode;
|
||||||
public world.Avatar ClientAvatar;
|
public world.Avatar ClientAvatar;
|
||||||
private UseCircuitCodePacket cirpack;
|
private UseCircuitCodePacket cirpack;
|
||||||
|
@ -277,41 +278,22 @@ namespace OpenSim
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PacketType.AssetUploadRequest:
|
case PacketType.AssetUploadRequest:
|
||||||
//AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
||||||
//Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
|
Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
|
||||||
//AssetBase newAsset = OpenSim_Main.sim.assetCache.UploadPacket(request);
|
AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random());
|
||||||
//Console.WriteLine(request.ToString());
|
if (newAsset != null)
|
||||||
|
|
||||||
/*if(newAsset != null)
|
|
||||||
{
|
{
|
||||||
if(!this.UploadedAssets.ContainsKey(newAsset.FullID))
|
OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset);
|
||||||
{
|
|
||||||
this.UploadedAssets.Add(newAsset.FullID, newAsset);
|
|
||||||
}
|
}
|
||||||
}*/
|
Console.WriteLine(request.ToString());
|
||||||
/*AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
Console.WriteLine("combined uuid is " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
|
||||||
|
|
||||||
|
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
||||||
response.AssetBlock.Type =request.AssetBlock.Type;
|
response.AssetBlock.Type =request.AssetBlock.Type;
|
||||||
response.AssetBlock.Success = false;
|
response.AssetBlock.Success = true;
|
||||||
response.AssetBlock.UUID = request.AssetBlock.TransactionID;
|
response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID);
|
||||||
|
|
||||||
this.OutPacket(response);*/
|
this.OutPacket(response);
|
||||||
break;
|
|
||||||
case PacketType.AssetUploadComplete:
|
|
||||||
//AssetUploadCompletePacket complete = (AssetUploadCompletePacket)Pack;
|
|
||||||
//Console.WriteLine("upload complete "+ complete.AssetBlock.UUID);
|
|
||||||
|
|
||||||
/*AssetBase completedAsset = OpenSim_Main.sim.assetCache.TransactionComplete(complete.AssetBlock.UUID);
|
|
||||||
if(completedAsset != null)
|
|
||||||
{
|
|
||||||
if(!this.UploadedAssets.ContainsKey(completedAsset.FullID))
|
|
||||||
{
|
|
||||||
this.UploadedAssets.Remove(completedAsset.FullID);
|
|
||||||
if(this.newAssetFolder != LLUUID.Zero)
|
|
||||||
{
|
|
||||||
OpenSim_Main.sim.inventoryManager.AddNewInventoryItem(this, this.newAssetFolder, completedAsset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
break;
|
break;
|
||||||
case PacketType.CreateInventoryFolder:
|
case PacketType.CreateInventoryFolder:
|
||||||
//Console.WriteLine(Pack.ToString());
|
//Console.WriteLine(Pack.ToString());
|
||||||
|
@ -594,6 +576,10 @@ namespace OpenSim
|
||||||
InitNewClient(); //shouldn't be called here as we might be a child agent and not want a full avatar
|
InitNewClient(); //shouldn't be called here as we might be a child agent and not want a full avatar
|
||||||
this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
|
this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
|
||||||
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
|
this.ClientAvatar.lastname = sessionInfo.LoginInfo.Last;
|
||||||
|
if (sessionInfo.LoginInfo.SecureSession != LLUUID.Zero)
|
||||||
|
{
|
||||||
|
this.SecureSessionID = sessionInfo.LoginInfo.SecureSession;
|
||||||
|
}
|
||||||
|
|
||||||
// Create Inventory, currently only works for sandbox mode
|
// Create Inventory, currently only works for sandbox mode
|
||||||
if (OpenSimRoot.Instance.Sandbox)
|
if (OpenSimRoot.Instance.Sandbox)
|
||||||
|
|
|
@ -269,7 +269,7 @@ namespace OpenSim.UserServer
|
||||||
Agent = GetAgentId(first, last);
|
Agent = GetAgentId(first, last);
|
||||||
int SessionRand = Util.RandomClass.Next(1, 999);
|
int SessionRand = Util.RandomClass.Next(1, 999);
|
||||||
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||||
|
LLUUID secureSess = LLUUID.Random();
|
||||||
//create some login info
|
//create some login info
|
||||||
Hashtable LoginFlagsHash = new Hashtable();
|
Hashtable LoginFlagsHash = new Hashtable();
|
||||||
LoginFlagsHash["daylight_savings"] = "N";
|
LoginFlagsHash["daylight_savings"] = "N";
|
||||||
|
@ -293,6 +293,7 @@ namespace OpenSim.UserServer
|
||||||
responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
||||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||||
responseData["session_id"] = Session.ToStringHyphenated();
|
responseData["session_id"] = Session.ToStringHyphenated();
|
||||||
|
responseData["secure_session_id"]= secureSess.ToStringHyphenated();
|
||||||
responseData["circuit_code"] = (Int32)(Util.RandomClass.Next());
|
responseData["circuit_code"] = (Int32)(Util.RandomClass.Next());
|
||||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||||
responseData["login-flags"] = LoginFlags;
|
responseData["login-flags"] = LoginFlags;
|
||||||
|
@ -306,7 +307,7 @@ namespace OpenSim.UserServer
|
||||||
LLUUID InventoryFolderID = LLUUID.Random();
|
LLUUID InventoryFolderID = LLUUID.Random();
|
||||||
Inventory2["name"] = "Base";
|
Inventory2["name"] = "Base";
|
||||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||||
Inventory2["type_default"] = 6;
|
Inventory2["type_default"] = 0;
|
||||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||||
|
|
||||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||||
|
@ -321,6 +322,7 @@ namespace OpenSim.UserServer
|
||||||
_login.Last = last;
|
_login.Last = last;
|
||||||
_login.Agent = Agent;
|
_login.Agent = Agent;
|
||||||
_login.Session = Session;
|
_login.Session = Session;
|
||||||
|
_login.SecureSession = secureSess;
|
||||||
_login.BaseFolder = BaseFolderID;
|
_login.BaseFolder = BaseFolderID;
|
||||||
_login.InventoryFolder = InventoryFolderID;
|
_login.InventoryFolder = InventoryFolderID;
|
||||||
|
|
||||||
|
@ -389,6 +391,7 @@ namespace OpenSim.UserServer
|
||||||
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
|
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IUserServer implementation
|
||||||
public AgentInventory RequestAgentsInventory(LLUUID agentID)
|
public AgentInventory RequestAgentsInventory(LLUUID agentID)
|
||||||
{
|
{
|
||||||
AgentInventory aInventory = null;
|
AgentInventory aInventory = null;
|
||||||
|
|
Loading…
Reference in New Issue