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)
|
||||
{
|
||||
|
||||
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)
|
||||
|
@ -156,9 +161,10 @@ namespace OpenSim.GridInterfaces.Local
|
|||
db.Set(store);
|
||||
db.Commit();
|
||||
|
||||
|
||||
Image = new AssetBase();
|
||||
Image.FullID = new LLUUID("00000000-0000-0000-5005-000000000005");
|
||||
Image.Name = "Prim Base Texture";
|
||||
this.LoadAsset(Image, true, "testpic2.jp2");
|
||||
store = new AssetStorage();
|
||||
store.Data = Image.Data;
|
||||
store.Name = Image.Name;
|
||||
|
@ -185,7 +191,7 @@ namespace OpenSim.GridInterfaces.Local
|
|||
//should request Asset from storage manager
|
||||
//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);
|
||||
FileInfo fInfo = new FileInfo(fileName);
|
||||
long numBytes = fInfo.Length;
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace OpenSim.GridInterfaces.Remote
|
|||
user.LoginInfo = new Login();
|
||||
user.LoginInfo.Agent = agentID;
|
||||
user.LoginInfo.Session = sessionID;
|
||||
user.LoginInfo.SecureSession = validcircuit.SecureSessionID;
|
||||
user.LoginInfo.First = validcircuit.firstname;
|
||||
user.LoginInfo.Last = validcircuit.lastname;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ using libsecondlife.Packets;
|
|||
using OpenSim;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
using OpenSim.Framework.Assets;
|
||||
using OpenSim.Framework.Utilities;
|
||||
|
||||
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> 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 Thread _assetCacheThread;
|
||||
|
@ -66,7 +67,7 @@ namespace OpenSim.Assets
|
|||
_assetServer.SetReceiver(this);
|
||||
Assets = new Dictionary<libsecondlife.LLUUID, AssetInfo>();
|
||||
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.IsBackground = true;
|
||||
this._assetCacheThread.Start();
|
||||
|
@ -82,9 +83,10 @@ namespace OpenSim.Assets
|
|||
{
|
||||
try
|
||||
{
|
||||
//Console.WriteLine("Asset cache loop");
|
||||
this.ProcessAssetQueue();
|
||||
this.ProcessTextureQueue();
|
||||
Thread.Sleep(100);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -115,6 +117,7 @@ namespace OpenSim.Assets
|
|||
inventorySet[i] = this.CloneImage(agentID, this.Textures[textureList[i]]);
|
||||
TextureImage image = new TextureImage(inventorySet[i]);
|
||||
this.Textures.Add(image.FullID, image);
|
||||
this._assetServer.UploadNewAsset(image); //save the asset to the asset server
|
||||
}
|
||||
}
|
||||
return inventorySet;
|
||||
|
@ -142,80 +145,89 @@ namespace OpenSim.Assets
|
|||
num = 5;
|
||||
}
|
||||
AssetRequest req;
|
||||
Console.WriteLine("processing texture requests ( " + num + " )");
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
req = (AssetRequest)this.TextureRequests[i];
|
||||
|
||||
if (req.PacketCounter == 0)
|
||||
if (req.PacketCounter != req.NumPackets)
|
||||
{
|
||||
//first time for this request so send imagedata packet
|
||||
if (req.NumPackets == 1)
|
||||
// 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)
|
||||
{
|
||||
//only one packet so send whole file
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = 1;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||
im.ImageData.Data = req.ImageInfo.Data;
|
||||
im.ImageID.Codec = 2;
|
||||
req.RequestUser.OutPacket(im);
|
||||
req.PacketCounter++;
|
||||
//req.ImageInfo.l= time;
|
||||
//System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||
//first time for this request so send imagedata packet
|
||||
if (req.NumPackets == 1)
|
||||
{
|
||||
//only one packet so send whole file
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = 1;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||
im.ImageData.Data = req.ImageInfo.Data;
|
||||
im.ImageID.Codec = 2;
|
||||
req.RequestUser.OutPacket(im);
|
||||
req.PacketCounter++;
|
||||
//req.ImageInfo.l= time;
|
||||
//System.Console.WriteLine("sent texture: "+req.image_info.FullID);
|
||||
}
|
||||
else
|
||||
{
|
||||
//more than one packet so split file up
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = (ushort)req.NumPackets;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||
im.ImageData.Data = new byte[600];
|
||||
Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
|
||||
im.ImageID.Codec = 2;
|
||||
req.RequestUser.OutPacket(im);
|
||||
req.PacketCounter++;
|
||||
//req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent first packet of texture:
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//send imagepacket
|
||||
//more than one packet so split file up
|
||||
ImageDataPacket im = new ImageDataPacket();
|
||||
im.ImageID.Packets = (ushort)req.NumPackets;
|
||||
ImagePacketPacket im = new ImagePacketPacket();
|
||||
im.ImageID.Packet = (ushort)req.PacketCounter;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
im.ImageID.Size = (uint)req.ImageInfo.Data.Length;
|
||||
im.ImageData.Data = new byte[600];
|
||||
Array.Copy(req.ImageInfo.Data, 0, im.ImageData.Data, 0, 600);
|
||||
im.ImageID.Codec = 2;
|
||||
int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
|
||||
if (size > 1000) size = 1000;
|
||||
im.ImageData.Data = new byte[size];
|
||||
Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
|
||||
req.RequestUser.OutPacket(im);
|
||||
req.PacketCounter++;
|
||||
//req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent first packet of texture:
|
||||
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//send imagepacket
|
||||
//more than one packet so split file up
|
||||
ImagePacketPacket im = new ImagePacketPacket();
|
||||
im.ImageID.Packet = (ushort)req.PacketCounter;
|
||||
im.ImageID.ID = req.ImageInfo.FullID;
|
||||
int size = req.ImageInfo.Data.Length - 600 - 1000 * (req.PacketCounter - 1);
|
||||
if (size > 1000) size = 1000;
|
||||
im.ImageData.Data = new byte[size];
|
||||
Array.Copy(req.ImageInfo.Data, 600 + 1000 * (req.PacketCounter - 1), im.ImageData.Data, 0, size);
|
||||
req.RequestUser.OutPacket(im);
|
||||
req.PacketCounter++;
|
||||
//req.ImageInfo.last_used = time;
|
||||
//System.Console.WriteLine("sent a packet of texture: "+req.image_info.FullID);
|
||||
}
|
||||
}
|
||||
|
||||
//remove requests that have been completed
|
||||
int count = 0;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
req = (AssetRequest)this.TextureRequests[count];
|
||||
if (req.PacketCounter == req.NumPackets)
|
||||
if (this.TextureRequests.Count > count)
|
||||
{
|
||||
this.TextureRequests.Remove(req);
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
req = (AssetRequest)this.TextureRequests[count];
|
||||
if (req.PacketCounter == req.NumPackets)
|
||||
{
|
||||
this.TextureRequests.Remove(req);
|
||||
}
|
||||
else
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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
|
||||
{
|
||||
//check if it is a texture or not
|
||||
|
@ -230,6 +242,15 @@ namespace OpenSim.Assets
|
|||
{
|
||||
AssetRequest req = this.RequestedTextures[image.FullID];
|
||||
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.TextureRequests.Add(req);
|
||||
}
|
||||
|
@ -242,6 +263,15 @@ namespace OpenSim.Assets
|
|||
{
|
||||
AssetRequest req = this.RequestedAssets[assetInf.FullID];
|
||||
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.AssetRequests.Add(req);
|
||||
}
|
||||
|
@ -403,6 +433,9 @@ namespace OpenSim.Assets
|
|||
/// <param name="imageID"></param>
|
||||
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
|
||||
if (!this.Textures.ContainsKey(imageID))
|
||||
{
|
||||
|
@ -452,50 +485,46 @@ namespace OpenSim.Assets
|
|||
#endregion
|
||||
|
||||
#region viewer asset uploading
|
||||
/* public AssetBase UploadPacket(AssetUploadRequestPacket pack)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
if(this.IncomingAssets.ContainsKey(pack.AssetBlock.TransactionID))
|
||||
{
|
||||
// not the first packet of this transaction
|
||||
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
|
||||
asset = new AssetBase();
|
||||
asset.FullID = LLUUID.Random();
|
||||
asset.Type = pack.AssetBlock.Type;
|
||||
asset.InvType = asset.Type;
|
||||
asset.Data = pack.AssetBlock.AssetData;
|
||||
//this.IncomingAssets.Add(pack.AssetBlock.TransactionID,asset);
|
||||
TextureImage image = new TextureImage(asset);
|
||||
this.Textures.Add(image.FullID, image);
|
||||
|
||||
}
|
||||
return asset;
|
||||
}
|
||||
|
||||
/*
|
||||
public AssetBase TransactionComplete(LLUUID transactionID)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
if(this.IncomingAssets.ContainsKey(transactionID))
|
||||
{
|
||||
// not the first packet of this transaction
|
||||
asset = this.IncomingAssets[transactionID];
|
||||
if(asset.Type == 0)
|
||||
{
|
||||
TextureImage image = new TextureImage(asset);
|
||||
this.Textures.Add(image.FullID, image);
|
||||
}
|
||||
}
|
||||
return asset;
|
||||
}*/
|
||||
public AssetBase UploadPacket(AssetUploadRequestPacket pack, LLUUID assetID)
|
||||
{
|
||||
|
||||
AssetBase asset = null;
|
||||
if (pack.AssetBlock.Type == 0)
|
||||
{
|
||||
if (pack.AssetBlock.AssetData.Length > 0)
|
||||
{
|
||||
//first packet for transaction
|
||||
asset = new AssetBase();
|
||||
asset.FullID = assetID;
|
||||
asset.Type = pack.AssetBlock.Type;
|
||||
asset.InvType = asset.Type;
|
||||
asset.Name = "UploadedTexture" + Util.RandomClass.Next(1, 1000).ToString("000");
|
||||
asset.Data = pack.AssetBlock.AssetData;
|
||||
this._assetServer.UploadNewAsset(asset);
|
||||
TextureImage image = new TextureImage(asset);
|
||||
this.Textures.Add(image.FullID, image);
|
||||
}
|
||||
}
|
||||
|
||||
return asset;
|
||||
}
|
||||
|
||||
/*
|
||||
public AssetBase TransactionComplete(LLUUID transactionID)
|
||||
{
|
||||
AssetBase asset = null;
|
||||
if(this.IncomingAssets.ContainsKey(transactionID))
|
||||
{
|
||||
// not the first packet of this transaction
|
||||
asset = this.IncomingAssets[transactionID];
|
||||
if(asset.Type == 0)
|
||||
{
|
||||
TextureImage image = new TextureImage(asset);
|
||||
this.Textures.Add(image.FullID, image);
|
||||
}
|
||||
}
|
||||
return asset;
|
||||
}*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -49,29 +49,10 @@ using OpenSim.Physics.Manager;
|
|||
namespace OpenSim
|
||||
{
|
||||
/// <summary>
|
||||
/// Description of MainForm.
|
||||
///
|
||||
/// </summary>
|
||||
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 PhysicsManager physManager;
|
||||
|
||||
|
@ -84,7 +65,7 @@ namespace OpenSim
|
|||
private AsyncCallback ReceivedData;
|
||||
|
||||
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";
|
||||
public bool sandbox = false;
|
||||
public bool loginserver = false;
|
||||
|
@ -123,18 +104,19 @@ namespace OpenSim
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
OpenSimRoot.Instance.GridServers = new Grid();
|
||||
if (sim.sandbox)
|
||||
{
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Local.dll";
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "LocalGridServers.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "LocalGridServers.dll";
|
||||
OpenSimRoot.Instance.GridServers.Initialise();
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Starting in Sandbox mode");
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "OpenSim.GridInterfaces.Remote.dll";
|
||||
OpenSimRoot.Instance.GridServers.AssetDll = "RemoteGridServers.dll";
|
||||
OpenSimRoot.Instance.GridServers.GridDll = "RemoteGridServers.dll";
|
||||
OpenSimRoot.Instance.GridServers.Initialise();
|
||||
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.Startup();
|
||||
}
|
||||
OpenSimRoot.Instance.AssetCache = new AssetCache(OpenSimRoot.Instance.GridServers.AssetServer);
|
||||
OpenSimRoot.Instance.InventoryCache = new InventoryCache();
|
||||
|
||||
OpenSimRoot.Instance.StartUp();
|
||||
|
||||
|
@ -163,6 +143,9 @@ namespace OpenSim
|
|||
{
|
||||
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
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("Main.cs:Startup() - Loading configuration");
|
||||
OpenSimRoot.Instance.Cfg = this.LoadConfigDll(this.ConfigDll);
|
||||
|
@ -177,6 +160,7 @@ namespace OpenSim
|
|||
|
||||
this.physManager = new OpenSim.Physics.Manager.PhysicsManager();
|
||||
this.physManager.LoadPlugins();
|
||||
|
||||
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.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.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();
|
||||
|
||||
if (this.sandbox)
|
||||
|
@ -241,6 +225,8 @@ namespace OpenSim
|
|||
|
||||
// This is either a new client or a packet to send to an old one
|
||||
// if (OpenSimRoot.Instance.ClientThreads.ContainsKey(epSender))
|
||||
|
||||
// do we already have a circuit for this endpoint
|
||||
if(this.clientCircuits.ContainsKey(epSender))
|
||||
{
|
||||
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)
|
||||
{
|
||||
// find the endpoint for this circuit
|
||||
EndPoint sendto = null;
|
||||
foreach(KeyValuePair<EndPoint, uint> p in this.clientCircuits)
|
||||
{
|
||||
|
@ -293,6 +280,7 @@ namespace OpenSim
|
|||
}
|
||||
if (sendto != null)
|
||||
{
|
||||
//we found the endpoint so send the packet to it
|
||||
this.Server.SendTo(buffer, size, flags, sendto);
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +312,6 @@ namespace OpenSim
|
|||
|
||||
void Timer1Tick(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
OpenSimRoot.Instance.LocalWorld.Update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ using OpenSim.Physics.Manager;
|
|||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace OpenSim
|
|||
|
||||
public LLUUID AgentID;
|
||||
public LLUUID SessionID;
|
||||
public LLUUID SecureSessionID = LLUUID.Zero;
|
||||
public uint CircuitCode;
|
||||
public world.Avatar ClientAvatar;
|
||||
private UseCircuitCodePacket cirpack;
|
||||
|
@ -277,41 +278,22 @@ namespace OpenSim
|
|||
|
||||
break;
|
||||
case PacketType.AssetUploadRequest:
|
||||
//AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
||||
//Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
|
||||
//AssetBase newAsset = OpenSim_Main.sim.assetCache.UploadPacket(request);
|
||||
//Console.WriteLine(request.ToString());
|
||||
|
||||
/*if(newAsset != null)
|
||||
AssetUploadRequestPacket request = (AssetUploadRequestPacket)Pack;
|
||||
Console.WriteLine("upload request "+ request.AssetBlock.TransactionID);
|
||||
AssetBase newAsset = OpenSimRoot.Instance.AssetCache.UploadPacket(request, LLUUID.Random());
|
||||
if (newAsset != null)
|
||||
{
|
||||
if(!this.UploadedAssets.ContainsKey(newAsset.FullID))
|
||||
{
|
||||
this.UploadedAssets.Add(newAsset.FullID, newAsset);
|
||||
}
|
||||
}*/
|
||||
/*AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
||||
OpenSimRoot.Instance.InventoryCache.AddNewInventoryItem(this, this.newAssetFolder, newAsset);
|
||||
}
|
||||
Console.WriteLine(request.ToString());
|
||||
Console.WriteLine("combined uuid is " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated());
|
||||
|
||||
AssetUploadCompletePacket response = new AssetUploadCompletePacket();
|
||||
response.AssetBlock.Type =request.AssetBlock.Type;
|
||||
response.AssetBlock.Success = false;
|
||||
response.AssetBlock.UUID = request.AssetBlock.TransactionID;
|
||||
response.AssetBlock.Success = true;
|
||||
response.AssetBlock.UUID = request.AssetBlock.TransactionID.Combine(this.SecureSessionID);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
} */
|
||||
this.OutPacket(response);
|
||||
break;
|
||||
case PacketType.CreateInventoryFolder:
|
||||
//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
|
||||
this.ClientAvatar.firstname = sessionInfo.LoginInfo.First;
|
||||
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
|
||||
if (OpenSimRoot.Instance.Sandbox)
|
||||
|
|
|
@ -269,7 +269,7 @@ namespace OpenSim.UserServer
|
|||
Agent = GetAgentId(first, last);
|
||||
int SessionRand = Util.RandomClass.Next(1, 999);
|
||||
Session = new LLUUID("aaaabbbb-0200-" + SessionRand.ToString("0000") + "-8664-58f53e442797");
|
||||
|
||||
LLUUID secureSess = LLUUID.Random();
|
||||
//create some login info
|
||||
Hashtable LoginFlagsHash = new Hashtable();
|
||||
LoginFlagsHash["daylight_savings"] = "N";
|
||||
|
@ -293,6 +293,7 @@ namespace OpenSim.UserServer
|
|||
responseData["sim_ip"] = OpenSimRoot.Instance.Cfg.IPListenAddr;
|
||||
responseData["agent_id"] = Agent.ToStringHyphenated();
|
||||
responseData["session_id"] = Session.ToStringHyphenated();
|
||||
responseData["secure_session_id"]= secureSess.ToStringHyphenated();
|
||||
responseData["circuit_code"] = (Int32)(Util.RandomClass.Next());
|
||||
responseData["seconds_since_epoch"] = (Int32)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
responseData["login-flags"] = LoginFlags;
|
||||
|
@ -306,7 +307,7 @@ namespace OpenSim.UserServer
|
|||
LLUUID InventoryFolderID = LLUUID.Random();
|
||||
Inventory2["name"] = "Base";
|
||||
Inventory2["folder_id"] = BaseFolderID.ToStringHyphenated();
|
||||
Inventory2["type_default"] = 6;
|
||||
Inventory2["type_default"] = 0;
|
||||
Inventory1["folder_id"] = InventoryFolderID.ToStringHyphenated();
|
||||
|
||||
ArrayList InventoryRoot = (ArrayList)responseData["inventory-root"];
|
||||
|
@ -321,6 +322,7 @@ namespace OpenSim.UserServer
|
|||
_login.Last = last;
|
||||
_login.Agent = Agent;
|
||||
_login.Session = Session;
|
||||
_login.SecureSession = secureSess;
|
||||
_login.BaseFolder = BaseFolderID;
|
||||
_login.InventoryFolder = InventoryFolderID;
|
||||
|
||||
|
@ -389,6 +391,7 @@ namespace OpenSim.UserServer
|
|||
return Regex.Replace(BitConverter.ToString(encodedBytes), "-", "").ToLower();
|
||||
}
|
||||
|
||||
//IUserServer implementation
|
||||
public AgentInventory RequestAgentsInventory(LLUUID agentID)
|
||||
{
|
||||
AgentInventory aInventory = null;
|
||||
|
|
Loading…
Reference in New Issue