mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 08:55:56 +08:00
seems to compile ( tests comented out)
This commit is contained in:
@@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.Framework.Scenes.Serialization;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Client;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
@@ -360,8 +359,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public string SeedCapRequest(string request, string path, string param,
|
||||
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
|
||||
m_log.DebugFormat(
|
||||
"[CAPS]: Received SEED caps request in {0} for agent {1}", m_regionName, m_HostCapsObj.AgentID);
|
||||
|
||||
if (!m_HostCapsObj.WaitForActivation())
|
||||
return string.Empty;
|
||||
@@ -789,99 +788,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
else if (inventoryType == "object")
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
inType = (sbyte)InventoryType.Object;
|
||||
assType = (sbyte)AssetType.Object;
|
||||
|
||||
List<Vector3> positions = new List<Vector3>();
|
||||
List<Quaternion> rotations = new List<Quaternion>();
|
||||
OSDMap request = (OSDMap)OSDParser.DeserializeLLSDXml(data);
|
||||
OSDArray instance_list = (OSDArray)request["instance_list"];
|
||||
OSDArray mesh_list = (OSDArray)request["mesh_list"];
|
||||
OSDArray texture_list = (OSDArray)request["texture_list"];
|
||||
SceneObjectGroup grp = null;
|
||||
|
||||
InventoryFolderBase textureUploadFolder = null;
|
||||
|
||||
List<InventoryFolderBase> foldersToUpdate = new List<InventoryFolderBase>();
|
||||
List<InventoryItemBase> itemsToUpdate = new List<InventoryItemBase>();
|
||||
IClientInventory clientInv = null;
|
||||
|
||||
if (texture_list.Count > 0)
|
||||
{
|
||||
ScenePresence avatar = null;
|
||||
m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar);
|
||||
|
||||
if (avatar != null)
|
||||
{
|
||||
IClientCore core = (IClientCore)avatar.ControllingClient;
|
||||
|
||||
if (core.TryGet<IClientInventory>(out clientInv))
|
||||
{
|
||||
var systemTextureFolder = m_Scene.InventoryService.GetFolderForType(m_HostCapsObj.AgentID, FolderType.Texture);
|
||||
textureUploadFolder = new InventoryFolderBase(UUID.Random(), assetName, m_HostCapsObj.AgentID, (short)FolderType.None, systemTextureFolder.ID, 1);
|
||||
if (m_Scene.InventoryService.AddFolder(textureUploadFolder))
|
||||
{
|
||||
foldersToUpdate.Add(textureUploadFolder);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new folder '{0}' ({1}) for textures uploaded with mesh object {2}",
|
||||
textureUploadFolder.Name, textureUploadFolder.ID, assetName);
|
||||
}
|
||||
else
|
||||
{
|
||||
textureUploadFolder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<UUID> textures = new List<UUID>();
|
||||
for (int i = 0; i < texture_list.Count; i++)
|
||||
{
|
||||
AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, "");
|
||||
textureAsset.Data = texture_list[i].AsBinary();
|
||||
m_assetService.Store(textureAsset);
|
||||
textures.Add(textureAsset.FullID);
|
||||
|
||||
if (textureUploadFolder != null)
|
||||
{
|
||||
InventoryItemBase textureItem = new InventoryItemBase();
|
||||
textureItem.Owner = m_HostCapsObj.AgentID;
|
||||
textureItem.CreatorId = m_HostCapsObj.AgentID.ToString();
|
||||
textureItem.CreatorData = String.Empty;
|
||||
textureItem.ID = UUID.Random();
|
||||
textureItem.AssetID = textureAsset.FullID;
|
||||
textureItem.Description = assetDescription;
|
||||
textureItem.Name = assetName + " - Texture " + (i + 1).ToString();
|
||||
textureItem.AssetType = (int)AssetType.Texture;
|
||||
textureItem.InvType = (int)InventoryType.Texture;
|
||||
textureItem.Folder = textureUploadFolder.ID;
|
||||
textureItem.CurrentPermissions
|
||||
= (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Export);
|
||||
textureItem.BasePermissions = (uint)PermissionMask.All | (uint)PermissionMask.Export;
|
||||
textureItem.EveryOnePermissions = 0;
|
||||
textureItem.NextPermissions = (uint)PermissionMask.All;
|
||||
textureItem.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
m_Scene.InventoryService.AddItem(textureItem);
|
||||
itemsToUpdate.Add(textureItem);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[BUNCH OF CAPS]: Created new inventory item '{0}' ({1}) for texture uploaded with mesh object {2}",
|
||||
textureItem.Name, textureItem.ID, assetName);
|
||||
}
|
||||
}
|
||||
|
||||
if (clientInv != null && (foldersToUpdate.Count > 0 || itemsToUpdate.Count > 0))
|
||||
{
|
||||
clientInv.SendBulkUpdateInventory(foldersToUpdate.ToArray(), itemsToUpdate.ToArray());
|
||||
}
|
||||
=======
|
||||
if (assetType == "mesh") // this code for now is for mesh models uploads only
|
||||
{
|
||||
inType = (sbyte)InventoryType.Object;
|
||||
assType = (sbyte)AssetType.Object;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
List<Vector3> positions = new List<Vector3>();
|
||||
List<Quaternion> rotations = new List<Quaternion>();
|
||||
@@ -1467,24 +1377,17 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
string message;
|
||||
copyItem = m_Scene.GiveInventoryItem(m_HostCapsObj.AgentID, item.Owner, itemID, folderID, out message);
|
||||
if (client != null)
|
||||
if (copyItem != null && client != null)
|
||||
{
|
||||
if (copyItem != null)
|
||||
{
|
||||
m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
|
||||
client.SendBulkUpdateInventory(copyItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.SendAgentAlertMessage(message, false);
|
||||
}
|
||||
m_log.InfoFormat("[CAPS]: CopyInventoryFromNotecard, ItemID:{0}, FolderID:{1}", copyItem.ID, copyItem.Folder);
|
||||
client.SendBulkUpdateInventory(copyItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[CAPS]: CopyInventoryFromNotecard - Failed to retrieve item {0} from notecard {1}", itemID, notecardID);
|
||||
if (client != null)
|
||||
client.SendAgentAlertMessage("Failed to retrieve item", false);
|
||||
client.SendAlertMessage("Failed to retrieve item");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -1656,14 +1559,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
string param, IOSHttpRequest httpRequest,
|
||||
IOSHttpResponse httpResponse)
|
||||
{
|
||||
OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap accessPrefs = (OSDMap)req["access_prefs"];
|
||||
string desiredMaturity = accessPrefs["max"];
|
||||
|
||||
// OSDMap req = (OSDMap)OSDParser.DeserializeLLSDXml(request);
|
||||
OSDMap resp = new OSDMap();
|
||||
OSDMap respAccessPrefs = new OSDMap();
|
||||
respAccessPrefs["max"] = desiredMaturity; // echoing the maturity back means success
|
||||
resp["access_prefs"] = respAccessPrefs;
|
||||
|
||||
OSDMap accessPrefs = new OSDMap();
|
||||
accessPrefs["max"] = "A";
|
||||
|
||||
resp["access_prefs"] = accessPrefs;
|
||||
|
||||
string response = OSDParser.SerializeLLSDXmlString(resp);
|
||||
return response;
|
||||
|
||||
@@ -40,8 +40,8 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
[assembly: Addin("LindenCaps", OpenSim.VersionInfo.VersionNumber)]
|
||||
[assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
|
||||
[assembly: Addin("LindenCaps", "0.1")]
|
||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||
namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
|
||||
|
||||
@@ -177,7 +177,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
<<<<<<< HEAD
|
||||
/// Always returns a valid queue
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
@@ -201,8 +200,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
/// May return a null queue
|
||||
/// </summary>
|
||||
/// <param name="agentId"></param>
|
||||
@@ -290,17 +288,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public void OnRegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
// Register an event queue for the client
|
||||
<<<<<<< HEAD
|
||||
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
=======
|
||||
m_log.DebugFormat(
|
||||
"[EVENTQUEUE]: OnRegisterCaps: agentID {0} caps {1} region {2}",
|
||||
agentID, caps, m_scene.RegionInfo.RegionName);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
UUID eventQueueGetUUID;
|
||||
Queue<OSD> queue;
|
||||
@@ -519,14 +511,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public virtual void EnableSimulator(ulong handle, IPEndPoint endPoint, UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EnableSimulator. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, handle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
=======
|
||||
m_log.DebugFormat("{0} EnableSimulator. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
OSD item = EventQueueHelper.EnableSimulator(handle, endPoint, regionSizeX, regionSizeY);
|
||||
Enqueue(item, avatarID);
|
||||
@@ -535,15 +522,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public virtual void EstablishAgentCommunication(UUID avatarID, IPEndPoint endPoint, string capsPath,
|
||||
ulong regionHandle, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, endPoint, avatarID, regionSizeX, regionSizeY);
|
||||
|
||||
=======
|
||||
m_log.DebugFormat("{0} EstablishAgentCommunication. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
|
||||
>>>>>>> avn/ubitvar
|
||||
OSD item = EventQueueHelper.EstablishAgentCommunication(avatarID, endPoint.ToString(), capsPath, regionHandle, regionSizeX, regionSizeY);
|
||||
Enqueue(item, avatarID);
|
||||
}
|
||||
@@ -553,14 +535,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
uint locationID, uint flags, string capsURL,
|
||||
UUID avatarID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, endPoint={2}, avatarID={3}",
|
||||
LogHeader, regionHandle, regionExternalEndPoint, avatarID, regionSizeX, regionSizeY);
|
||||
=======
|
||||
m_log.DebugFormat("{0} TeleportFinishEvent. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, regionHandle, avatarID, regionSizeX, regionSizeY);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
OSD item = EventQueueHelper.TeleportFinishEvent(regionHandle, simAccess, regionExternalEndPoint,
|
||||
locationID, flags, capsURL, avatarID, regionSizeX, regionSizeY);
|
||||
@@ -571,14 +548,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
IPEndPoint newRegionExternalEndPoint,
|
||||
string capsURL, UUID avatarID, UUID sessionID, int regionSizeX, int regionSizeY)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (DebugLevel > 0)
|
||||
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
=======
|
||||
m_log.DebugFormat("{0} CrossRegion. handle={1}, avatarID={2}, regionSize={3},{4}>",
|
||||
LogHeader, handle, avatarID, regionSizeX, regionSizeY);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
OSD item = EventQueueHelper.CrossRegion(handle, pos, lookAt, newRegionExternalEndPoint,
|
||||
capsURL, avatarID, sessionID, regionSizeX, regionSizeY);
|
||||
|
||||
@@ -77,13 +77,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
llsdSimInfo.Add("Handle", new OSDBinary(ulongToByteArray(handle)));
|
||||
llsdSimInfo.Add("IP", new OSDBinary(endPoint.Address.GetAddressBytes()));
|
||||
llsdSimInfo.Add("Port", new OSDInteger(endPoint.Port));
|
||||
<<<<<<< HEAD
|
||||
llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint) regionSizeX));
|
||||
llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint) regionSizeY));
|
||||
=======
|
||||
llsdSimInfo.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
|
||||
llsdSimInfo.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
OSDArray arr = new OSDArray(1);
|
||||
arr.Add(llsdSimInfo);
|
||||
@@ -176,12 +171,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
info.Add("SimAccess", OSD.FromInteger(simAccess));
|
||||
info.Add("SimIP", OSD.FromBinary(regionExternalEndPoint.Address.GetAddressBytes()));
|
||||
info.Add("SimPort", OSD.FromInteger(regionExternalEndPoint.Port));
|
||||
<<<<<<< HEAD
|
||||
info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
|
||||
=======
|
||||
// info.Add("TeleportFlags", OSD.FromULong(1L << 4)); // AgentManager.TeleportFlags.ViaLocation
|
||||
info.Add("TeleportFlags", OSD.FromUInteger(flags));
|
||||
>>>>>>> avn/ubitvar
|
||||
info.Add("RegionSizeX", OSD.FromUInteger((uint)regionSizeX));
|
||||
info.Add("RegionSizeY", OSD.FromUInteger((uint)regionSizeY));
|
||||
|
||||
|
||||
@@ -60,11 +60,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private IAssetService m_AssetService;
|
||||
private bool m_Enabled = true;
|
||||
private string m_URL;
|
||||
<<<<<<< HEAD
|
||||
|
||||
private string m_URL2;
|
||||
private string m_RedirectURL = null;
|
||||
private string m_RedirectURL2 = null;
|
||||
=======
|
||||
|
||||
struct aPollRequest
|
||||
{
|
||||
@@ -94,7 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
|
||||
private Dictionary<UUID, PollServiceMeshEventArgs> m_pollservices = new Dictionary<UUID, PollServiceMeshEventArgs>();
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
|
||||
#region Region Module interfaceBase Members
|
||||
|
||||
@@ -129,12 +128,9 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
if (m_URL2 != string.Empty)
|
||||
{
|
||||
m_Enabled = true;
|
||||
<<<<<<< HEAD
|
||||
|
||||
m_RedirectURL2 = config.GetString("GetMesh2RedirectURL");
|
||||
}
|
||||
=======
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
public void AddRegion(Scene pScene)
|
||||
@@ -177,7 +173,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
for (uint i = 0; i < 2; i++)
|
||||
{
|
||||
m_workerThreads[i] = Watchdog.StartThread(DoMeshRequests,
|
||||
m_workerThreads[i] = WorkManager.StartThread(DoMeshRequests,
|
||||
String.Format("MeshWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
@@ -336,21 +332,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
UUID capID = UUID.Random();
|
||||
bool getMeshRegistered = false;
|
||||
|
||||
if (m_URL == string.Empty)
|
||||
{
|
||||
|
||||
}
|
||||
else if (m_URL == "localhost")
|
||||
{
|
||||
getMeshRegistered = true;
|
||||
caps.RegisterHandler(
|
||||
"GetMesh",
|
||||
new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh", agentID.ToString(), m_RedirectURL));
|
||||
=======
|
||||
// UUID capID = UUID.Random();
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
@@ -375,34 +356,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
caps.RegisterHandler("GetMesh", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
m_pollservices[agentID] = args;
|
||||
m_capsDict[agentID] = capUrl;
|
||||
|
||||
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
else
|
||||
{
|
||||
caps.RegisterHandler("GetMesh", m_URL);
|
||||
}
|
||||
|
||||
if(m_URL2 == string.Empty)
|
||||
{
|
||||
|
||||
}
|
||||
else if (m_URL2 == "localhost")
|
||||
{
|
||||
if (!getMeshRegistered)
|
||||
{
|
||||
caps.RegisterHandler(
|
||||
"GetMesh2",
|
||||
new GetMeshHandler("/CAPS/" + capID + "/", m_AssetService, "GetMesh2", agentID.ToString(), m_RedirectURL2));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caps.RegisterHandler("GetMesh2", m_URL2);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeregisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
string capUrl;
|
||||
|
||||
@@ -82,24 +82,22 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private static OpenMetaverse.BlockingQueue<aPollRequest> m_queue =
|
||||
new OpenMetaverse.BlockingQueue<aPollRequest>();
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
// TODO: Change this to a config option
|
||||
private string m_RedirectURL = null;
|
||||
=======
|
||||
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
private string m_URL;
|
||||
private Dictionary<UUID,PollServiceTextureEventArgs> m_pollservices = new Dictionary<UUID,PollServiceTextureEventArgs>();
|
||||
|
||||
|
||||
#region ISharedRegionModule Members
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
<<<<<<< HEAD
|
||||
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
/*
|
||||
m_URL = config.GetString("Cap_GetTexture", string.Empty);
|
||||
// Cap doesn't exist
|
||||
if (m_URL != string.Empty)
|
||||
@@ -107,10 +105,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_Enabled = true;
|
||||
m_RedirectURL = config.GetString("GetTextureRedirectURL");
|
||||
}
|
||||
=======
|
||||
if (config != null)
|
||||
m_Url = config.GetString("Cap_GetTexture", "localhost");
|
||||
>>>>>>> avn/ubitvar
|
||||
*/
|
||||
m_Url = config.GetString("Cap_GetTexture", "localhost");
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
@@ -142,7 +138,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
for (uint i = 0; i < 2; i++)
|
||||
{
|
||||
m_workerThreads[i] = Watchdog.StartThread(DoTextureRequests,
|
||||
m_workerThreads[i] = WorkManager.StartThread(DoTextureRequests,
|
||||
String.Format("TextureWorkerThread{0}", i),
|
||||
ThreadPriority.Normal,
|
||||
false,
|
||||
@@ -237,12 +233,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public PollServiceTextureEventArgs(UUID pId, Scene scene) :
|
||||
base(null, "", null, null, null, pId, int.MaxValue)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
// m_log.DebugFormat("[GETTEXTURE]: /CAPS/{0} in region {1}", capID, m_scene.RegionInfo.RegionName);
|
||||
caps.RegisterHandler(
|
||||
"GetTexture",
|
||||
new GetTextureHandler("/CAPS/" + capID + "/", m_assetService, "GetTexture", agentID.ToString(), m_RedirectURL));
|
||||
=======
|
||||
m_scene = scene;
|
||||
// x is request id, y is userid
|
||||
HasEvents = (x, y) =>
|
||||
@@ -312,7 +302,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
return response;
|
||||
};
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
public void Process(aPollRequest requestinfo)
|
||||
@@ -402,11 +391,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
}
|
||||
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>();
|
||||
if (handler != null)
|
||||
<<<<<<< HEAD
|
||||
handler.RegisterExternalUserCapsHandler(agentID,caps,"GetTexture", m_URL);
|
||||
=======
|
||||
handler.RegisterExternalUserCapsHandler(agentID, caps, "GetTexture", capUrl);
|
||||
>>>>>>> avn/ubitvar
|
||||
else
|
||||
caps.RegisterHandler("GetTexture", String.Format("{0}://{1}:{2}{3}", protocol, hostName, port, capUrl));
|
||||
m_pollservices[agentID] = args;
|
||||
@@ -422,7 +407,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
PollServiceTextureEventArgs args;
|
||||
|
||||
MainServer.Instance.RemoveHTTPHandler("", m_URL);
|
||||
MainServer.Instance.RemoveHTTPHandler("", m_Url);
|
||||
m_capsDict.Remove(agentID);
|
||||
|
||||
if (m_pollservices.TryGetValue(agentID, out args))
|
||||
|
||||
@@ -157,11 +157,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_features["MeshXferEnabled"] = true;
|
||||
|
||||
m_features["PhysicsMaterialsEnabled"] = true;
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
OSDMap typesMap = new OSDMap();
|
||||
typesMap["convex"] = true;
|
||||
typesMap["none"] = true;
|
||||
@@ -169,7 +165,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
m_features["PhysicsShapeTypes"] = typesMap;
|
||||
|
||||
// Extra information for viewers that want to use it
|
||||
<<<<<<< HEAD
|
||||
// TODO: Take these out of here into their respective modules, like map-server-url
|
||||
OSDMap extrasMap;
|
||||
if(m_features.ContainsKey("OpenSimExtras"))
|
||||
@@ -179,15 +174,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
else
|
||||
extrasMap = new OSDMap();
|
||||
|
||||
=======
|
||||
|
||||
OSDMap extrasMap = new OSDMap();
|
||||
|
||||
extrasMap["AvatarSkeleton"] = true;
|
||||
extrasMap["AnimationSet"] = true;
|
||||
|
||||
// TODO: Take these out of here into their respective modules, like map-server-url
|
||||
>>>>>>> avn/ubitvar
|
||||
if (m_SearchURL != string.Empty)
|
||||
extrasMap["search-server-url"] = m_SearchURL;
|
||||
if (!string.IsNullOrEmpty(m_DestinationGuideURL))
|
||||
@@ -199,13 +189,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
if (m_GridName != string.Empty)
|
||||
extrasMap["GridName"] = m_GridName;
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (extrasMap.Count > 0)
|
||||
m_features["OpenSimExtras"] = extrasMap;
|
||||
=======
|
||||
m_features["OpenSimExtras"] = extrasMap;
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
|
||||
{
|
||||
/*
|
||||
[TestFixture]
|
||||
public class WebFetchInvDescModuleTests : OpenSimTestCase
|
||||
{
|
||||
@@ -156,4 +157,5 @@ namespace OpenSim.Region.ClientStack.Linden.Caps.Tests
|
||||
Assert.That((int)folderOsd["descendents"], Is.EqualTo(16));
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -66,16 +66,19 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
private bool m_persistBakedTextures;
|
||||
|
||||
private IBakedTextureModule m_BakedTextureModule;
|
||||
|
||||
private IBakedTextureModule m_BakedTextureModule;
|
||||
private string m_URL;
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
{
|
||||
IConfig config = source.Configs["ClientStack.LindenCaps"];
|
||||
if (config == null)
|
||||
return;
|
||||
|
||||
m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
|
||||
|
||||
IConfig appearanceConfig = source.Configs["Appearance"];
|
||||
if (appearanceConfig != null)
|
||||
m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
@@ -91,13 +94,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
s.EventManager.OnRemovePresence -= DeRegisterPresence;
|
||||
m_BakedTextureModule = null;
|
||||
m_scene = null;
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
|
||||
|
||||
public void RegionLoaded(Scene s)
|
||||
{
|
||||
@@ -109,173 +106,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
private void DeRegisterPresence(UUID agentId)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
ScenePresence presence = null;
|
||||
if (m_scene.TryGetScenePresence(agentId, out presence))
|
||||
{
|
||||
presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void RegisterNewPresence(ScenePresence presence)
|
||||
{
|
||||
presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
|
||||
|
||||
}
|
||||
|
||||
private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
|
||||
{
|
||||
int maxCacheitemsLoop = cacheItems.Length;
|
||||
if (maxCacheitemsLoop > AvatarWearable.MAX_WEARABLES)
|
||||
{
|
||||
maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
|
||||
}
|
||||
|
||||
m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
if (cacheItems.Length > 0)
|
||||
{
|
||||
// m_log.Debug("[Cacheitems]: " + cacheItems.Length);
|
||||
// for (int iter = 0; iter < maxCacheitemsLoop; iter++)
|
||||
// {
|
||||
// m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
|
||||
// cacheItems[iter].TextureID);
|
||||
// }
|
||||
|
||||
ScenePresence p = null;
|
||||
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
|
||||
{
|
||||
|
||||
WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
|
||||
if (existingitems == null)
|
||||
{
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
WearableCacheItem[] savedcache = null;
|
||||
try
|
||||
{
|
||||
if (p.Appearance.WearableCacheItemsDirty)
|
||||
{
|
||||
savedcache = m_BakedTextureModule.Get(p.UUID);
|
||||
p.Appearance.WearableCacheItems = savedcache;
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* The following Catch types DO NOT WORK with m_BakedTextureModule.Get
|
||||
* it jumps to the General Packet Exception Handler if you don't catch Exception!
|
||||
*
|
||||
catch (System.Net.Sockets.SocketException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (WebException)
|
||||
{
|
||||
cacheItems = null;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
cacheItems = null;
|
||||
} */
|
||||
catch (Exception)
|
||||
{
|
||||
// The service logs a sufficient error message.
|
||||
}
|
||||
|
||||
|
||||
if (savedcache != null)
|
||||
existingitems = savedcache;
|
||||
}
|
||||
}
|
||||
// Existing items null means it's a fully new appearance
|
||||
if (existingitems == null)
|
||||
{
|
||||
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
{
|
||||
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
|
||||
if (face == null)
|
||||
{
|
||||
textureEntry.CreateFace(cacheItems[i].TextureIndex);
|
||||
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
|
||||
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
continue;
|
||||
}
|
||||
cacheItems[i].TextureID =face.TextureID;
|
||||
if (m_scene.AssetService != null)
|
||||
cacheItems[i].TextureAsset =
|
||||
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
{
|
||||
// for each uploaded baked texture
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
{
|
||||
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
|
||||
if (face == null)
|
||||
{
|
||||
textureEntry.CreateFace(cacheItems[i].TextureIndex);
|
||||
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
|
||||
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
continue;
|
||||
}
|
||||
cacheItems[i].TextureID =
|
||||
face.TextureID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (cacheItems[i].TextureAsset == null)
|
||||
{
|
||||
cacheItems[i].TextureAsset =
|
||||
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
p.Appearance.WearableCacheItems = cacheItems;
|
||||
|
||||
|
||||
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
|
||||
p.Appearance.WearableCacheItemsDirty = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
// ScenePresence presence = null;
|
||||
// if (m_scene.TryGetScenePresence(agentId, out presence))
|
||||
{
|
||||
// presence.ControllingClient.OnSetAppearance -= CaptureAppearanceSettings;
|
||||
}
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
private void RegisterNewPresence(ScenePresence presence)
|
||||
@@ -441,25 +271,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
|
||||
public void RegisterCaps(UUID agentID, Caps caps)
|
||||
{
|
||||
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
||||
caps, m_scene.AssetService, m_persistBakedTextures);
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
caps.RegisterHandler(
|
||||
"UploadBakedTexture",
|
||||
new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/" + caps.CapsObjectPath + m_uploadBakedTexturePath,
|
||||
avatarhandler.UploadBakedTexture,
|
||||
"UploadBakedTexture",
|
||||
agentID.ToString()));
|
||||
|
||||
|
||||
|
||||
|
||||
=======
|
||||
//caps.RegisterHandler("GetTexture", new StreamHandler("GET", "/CAPS/" + capID, ProcessGetTexture));
|
||||
if (m_URL == "localhost")
|
||||
{
|
||||
@@ -480,7 +291,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
{
|
||||
caps.RegisterHandler("UploadBakedTexture", m_URL);
|
||||
}
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||
public List<UUID> folders;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
=======
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
/// <summary>
|
||||
/// Control whether requests will be processed asynchronously.
|
||||
|
||||
@@ -723,11 +723,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (!m_packetHandlers.ContainsKey(packetType))
|
||||
{
|
||||
m_packetHandlers.Add(
|
||||
<<<<<<< HEAD
|
||||
packetType, new PacketProcessor() { method = handler, Async = doAsync, InEngine = inEngine });
|
||||
=======
|
||||
packetType, new PacketProcessor() { method = handler, Async = doAsync });
|
||||
>>>>>>> avn/ubitvar
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
@@ -1228,15 +1224,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="map">heightmap</param>
|
||||
public virtual void SendLayerData(float[] map)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData(), "LLClientView.DoSendLayerData");
|
||||
=======
|
||||
Util.FireAndForget(DoSendLayerData, m_scene.Heightmap.GetTerrainData());
|
||||
|
||||
// Send it sync, and async. It's not that much data
|
||||
// and it improves user experience just so much!
|
||||
// DoSendLayerData(map);
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1250,18 +1242,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
try
|
||||
{
|
||||
// Send LayerData in typerwriter pattern
|
||||
<<<<<<< HEAD
|
||||
//for (int y = 0; y < 16; y++)
|
||||
//{
|
||||
// for (int x = 0; x < 16; x++)
|
||||
// {
|
||||
// SendLayerData(x, y, map);
|
||||
// }
|
||||
//}
|
||||
|
||||
// Send LayerData in a spiral pattern. Fun!
|
||||
SendLayerTopRight(map, 0, 0, map.SizeX/Constants.TerrainPatchSize-1, map.SizeY/Constants.TerrainPatchSize-1);
|
||||
=======
|
||||
for (int y = 0; y < 16; y++)
|
||||
{
|
||||
for (int x = 0; x < 16; x++)
|
||||
@@ -1269,7 +1250,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
SendLayerData(x, y, map);
|
||||
}
|
||||
}
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -1277,74 +1257,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private void SendLayerTopRight(TerrainData map, int x1, int y1, int x2, int y2)
|
||||
=======
|
||||
// Legacy form of invocation that passes around a bare data array.
|
||||
// Just ignore what was passed and use the real terrain info that is part of the scene.
|
||||
// As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
|
||||
// there is a special form for specifying multiple terrain patches to send.
|
||||
// The form is to pass 'px' as negative the number of patches to send and to
|
||||
// pass the float array as pairs of patch X and Y coordinates. So, passing 'px'
|
||||
// as -2 and map= [3, 5, 8, 4] would mean to send two terrain heightmap patches
|
||||
// and the patches to send are <3,5> and <8,4>.
|
||||
public void SendLayerData(int px, int py, float[] map)
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
if (px >= 0)
|
||||
{
|
||||
SendLayerData(px, py, m_scene.Heightmap.GetTerrainData());
|
||||
}
|
||||
else
|
||||
{
|
||||
int numPatches = -px;
|
||||
int[] xPatches = new int[numPatches];
|
||||
int[] yPatches = new int[numPatches];
|
||||
for (int pp = 0; pp < numPatches; pp++)
|
||||
{
|
||||
xPatches[pp] = (int)map[pp * 2];
|
||||
yPatches[pp] = (int)map[pp * 2 + 1];
|
||||
}
|
||||
|
||||
// DebugSendingPatches("SendLayerData", xPatches, yPatches);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (x2 - x1 > 0 && y2 - y1 > 0)
|
||||
SendLayerBottomLeft(map, x1, y1 + 1, x2 - 1, y2);
|
||||
}
|
||||
|
||||
void SendLayerBottomLeft(TerrainData map, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
// Row in reverse
|
||||
for (int i = x2; i >= x1; i--)
|
||||
SendLayerData(i, y2, map);
|
||||
|
||||
// Column in reverse
|
||||
for (int j = y2 - 1; j >= y1; j--)
|
||||
SendLayerData(x1, j, map);
|
||||
|
||||
if (x2 - x1 > 0 && y2 - y1 > 0)
|
||||
SendLayerTopRight(map, x1 + 1, y1, x2, y2 - 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sends a set of four patches (x, x+1, ..., x+3) to the client
|
||||
/// </summary>
|
||||
/// <param name="map">heightmap</param>
|
||||
/// <param name="px">X coordinate for patches 0..12</param>
|
||||
/// <param name="py">Y coordinate for patches 0..15</param>
|
||||
// private void SendLayerPacket(float[] map, int y, int x)
|
||||
// {
|
||||
// int[] patches = new int[4];
|
||||
// patches[0] = x + 0 + y * 16;
|
||||
// patches[1] = x + 1 + y * 16;
|
||||
// patches[2] = x + 2 + y * 16;
|
||||
// patches[3] = x + 3 + y * 16;
|
||||
|
||||
// Packet layerpack = LLClientView.TerrainManager.CreateLandPacket(map, patches);
|
||||
// OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
// }
|
||||
|
||||
// Legacy form of invocation that passes around a bare data array.
|
||||
// Just ignore what was passed and use the real terrain info that is part of the scene.
|
||||
// As a HORRIBLE kludge in an attempt to not change the definition of IClientAPI,
|
||||
@@ -1393,29 +1305,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
=======
|
||||
SendLayerData(xPatches, yPatches, m_scene.Heightmap.GetTerrainData());
|
||||
}
|
||||
}
|
||||
|
||||
private void DebugSendingPatches(string pWho, int[] pX, int[] pY)
|
||||
{
|
||||
if (m_log.IsDebugEnabled)
|
||||
{
|
||||
int numPatches = pX.Length;
|
||||
string Xs = "";
|
||||
string Ys = "";
|
||||
for (int pp = 0; pp < numPatches; pp++)
|
||||
{
|
||||
Xs += String.Format("{0}", (int)pX[pp]) + ",";
|
||||
Ys += String.Format("{0}", (int)pY[pp]) + ",";
|
||||
}
|
||||
m_log.DebugFormat("{0} {1}: numPatches={2}, X={3}, Y={4}", LogHeader, pWho, numPatches, Xs, Ys);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
>>>>>>> avn/ubitvar
|
||||
/// Sends a terrain packet for the point specified.
|
||||
/// This is a legacy call that has refarbed the terrain into a flat map of floats.
|
||||
/// We just use the terrain from the region we know about.
|
||||
@@ -1467,40 +1357,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// When a user edits the terrain, so much data is sent, the data queues up fast and presents a
|
||||
// sub optimal editing experience. To alleviate this issue, when the user edits the terrain, we
|
||||
// start skipping the queues until they're done editing the terrain. We also make them
|
||||
// unreliable because it's extremely likely that multiple packets will be sent for a terrain patch
|
||||
// area invalidating previous packets for that area.
|
||||
|
||||
// It's possible for an editing user to flood themselves with edited packets but the majority
|
||||
// of use cases are such that only a tiny percentage of users will be editing the terrain.
|
||||
// Other, non-editing users will see the edits much slower.
|
||||
|
||||
// One last note on this topic, by the time users are going to be editing the terrain, it's
|
||||
// extremely likely that the sim will have rezzed already and therefore this is not likely going
|
||||
// to cause any additional issues with lost packets, objects or terrain patches.
|
||||
|
||||
// m_justEditedTerrain is volatile, so test once and duplicate two affected statements so we
|
||||
// only have one cache miss.
|
||||
private void SendTheLayerPacket(LayerDataPacket layerpack)
|
||||
{
|
||||
if (m_justEditedTerrain)
|
||||
{
|
||||
layerpack.Header.Reliable = false;
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Unknown );
|
||||
}
|
||||
else
|
||||
{
|
||||
layerpack.Header.Reliable = true;
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
}
|
||||
=======
|
||||
private void SendTheLayerPacket(LayerDataPacket layerpack)
|
||||
{
|
||||
OutPacket(layerpack, ThrottleOutPacketType.Land);
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2490,15 +2349,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (agentid == AgentId)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
ActiveGroupId = activegroupid;
|
||||
ActiveGroupName = groupname;
|
||||
ActiveGroupPowers = grouppowers;
|
||||
=======
|
||||
m_activeGroupID = activegroupid;
|
||||
m_activeGroupName = groupname;
|
||||
m_activeGroupPowers = grouppowers;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate);
|
||||
@@ -3888,15 +3741,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
avp.Sender.IsTrial = false;
|
||||
avp.Sender.ID = agentID;
|
||||
avp.AppearanceData = new AvatarAppearancePacket.AppearanceDataBlock[0];
|
||||
<<<<<<< HEAD
|
||||
avp.AppearanceHover = new AvatarAppearancePacket.AppearanceHoverBlock[0];
|
||||
=======
|
||||
|
||||
// this need be use in future
|
||||
// avp.AppearanceData[0].AppearanceVersion = 0;
|
||||
// avp.AppearanceData[0].CofVersion = 0;
|
||||
// this need be use in future ?
|
||||
// avp.AppearanceData[0].AppearanceVersion = 0;
|
||||
// avp.AppearanceData[0].CofVersion = 0;
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
//m_log.DebugFormat("[CLIENT]: Sending appearance for {0} to {1}", agentID.ToString(), AgentId.ToString());
|
||||
OutPacket(avp, ThrottleOutPacketType.Task | ThrottleOutPacketType.HighPriority);
|
||||
}
|
||||
@@ -4014,22 +3864,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// </summary>
|
||||
public void SendEntityUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (entity.UUID == m_agentId && !updateFlags.HasFlag(PrimUpdateFlags.FullUpdate))
|
||||
{
|
||||
ImprovedTerseObjectUpdatePacket packet
|
||||
= (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
|
||||
=======
|
||||
if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart e = (SceneObjectPart)entity;
|
||||
SceneObjectGroup g = e.ParentGroup;
|
||||
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
|
||||
return; // Don't send updates for other people's HUDs
|
||||
}
|
||||
|
||||
uint priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
packet.RegionData.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
packet.RegionData.TimeDilation = Utils.FloatToUInt16(1, 0.0f, 1.0f);
|
||||
@@ -4037,6 +3875,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
packet.ObjectData[0] = CreateImprovedTerseBlock(entity, false);
|
||||
OutPacket(packet, ThrottleOutPacketType.Unknown, true);
|
||||
}
|
||||
|
||||
else if (entity is SceneObjectPart)
|
||||
{
|
||||
SceneObjectPart e = (SceneObjectPart)entity;
|
||||
SceneObjectGroup g = e.ParentGroup;
|
||||
if (g.HasPrivateAttachmentPoint && g.OwnerID != AgentId)
|
||||
return; // Don't send updates for other people's HUDs
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||
@@ -4385,15 +4232,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
OutPacket(packet, ThrottleOutPacketType.Task, true);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sent {0} updates in ProcessEntityUpdates() for {1} {2} in {3}",
|
||||
// updatesThisCall, Name, SceneAgent.IsChildAgent ? "child" : "root", Scene.Name);
|
||||
//
|
||||
#endregion Packet Sending
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
public void ReprioritizeUpdates()
|
||||
@@ -5360,11 +5203,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
ScenePresence presence = (ScenePresence)entity;
|
||||
|
||||
<<<<<<< HEAD
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending terse update to {0} with pos {1}, vel {2} in {3}",
|
||||
// Name, presence.OffsetPosition, presence.Velocity, m_scene.Name);
|
||||
=======
|
||||
position = presence.OffsetPosition;
|
||||
rotation = presence.Rotation;
|
||||
angularVelocity = presence.AngularVelocity;
|
||||
@@ -5373,7 +5211,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
attachPoint = 0;
|
||||
// m_log.DebugFormat(
|
||||
// "[LLCLIENTVIEW]: Sending terse update to {0} with position {1} in {2}", Name, presence.OffsetPosition, m_scene.Name);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
// attachPoint = presence.State; // Core: commented
|
||||
collisionPlane = presence.CollisionPlane;
|
||||
@@ -5495,24 +5332,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// "[LLCLIENTVIEW]: Sending full update to {0} with pos {1}, vel {2} in {3}", Name, data.OffsetPosition, data.Velocity, m_scene.Name);
|
||||
|
||||
byte[] objectData = new byte[76];
|
||||
<<<<<<< HEAD
|
||||
|
||||
data.CollisionPlane.ToBytes(objectData, 0);
|
||||
data.OffsetPosition.ToBytes(objectData, 16);
|
||||
data.Velocity.ToBytes(objectData, 28);
|
||||
// data.Acceleration.ToBytes(objectData, 40);
|
||||
|
||||
// Whilst not in mouselook, an avatar will transmit only the Z rotation as this is the only axis
|
||||
// it rotates around.
|
||||
// In mouselook, X and Y co-ordinate will also be sent but when used in Rotation, these cause unwanted
|
||||
// excessive up and down movements of the camera when looking up and down.
|
||||
// See http://opensimulator.org/mantis/view.php?id=3274
|
||||
// This does not affect head movement, since this is controlled entirely by camera movement rather than
|
||||
// body rotation. We still need to transmit X and Y for sitting avatars but mouselook does not change
|
||||
// the rotation in this case.
|
||||
Quaternion rot = data.Rotation;
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
Vector3 velocity = new Vector3(0, 0, 0);
|
||||
Vector3 acceleration = new Vector3(0, 0, 0);
|
||||
@@ -5596,11 +5415,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
//update.JointType = 0;
|
||||
update.Material = data.Material;
|
||||
update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
/*
|
||||
>>>>>>> avn/ubitvar
|
||||
if (data.ParentGroup.IsAttachment)
|
||||
{
|
||||
update.NameValue
|
||||
@@ -5625,7 +5440,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// case for attachments may contain conflicting values that can end up crashing the viewer.
|
||||
update.State = data.ParentGroup.RootPart.Shape.State;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
if (data.ParentGroup.IsAttachment)
|
||||
{
|
||||
@@ -9365,11 +9180,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if ((locX >= m_scene.RegionInfo.WorldLocX)
|
||||
&& (locX < (m_scene.RegionInfo.WorldLocX + m_scene.RegionInfo.RegionSizeX))
|
||||
&& (locY >= m_scene.RegionInfo.WorldLocY)
|
||||
<<<<<<< HEAD
|
||||
&& (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)) )
|
||||
=======
|
||||
&& (locY < (m_scene.RegionInfo.WorldLocY + m_scene.RegionInfo.RegionSizeY)))
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
tpLocReq.Info.RegionHandle = m_scene.RegionInfo.RegionHandle;
|
||||
tpLocReq.Info.Position.X += locX - m_scene.RegionInfo.WorldLocX;
|
||||
@@ -12285,7 +12096,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="packet"></param>
|
||||
/// <returns></returns>
|
||||
// TODO: Convert old handler to use new method
|
||||
/*protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
||||
/*
|
||||
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
||||
{
|
||||
AgentCachedTexturePacket cachedtex = (AgentCachedTexturePacket)packet;
|
||||
AgentCachedTextureResponsePacket cachedresp = (AgentCachedTextureResponsePacket)PacketPool.Instance.GetPacket(PacketType.AgentCachedTextureResponse);
|
||||
@@ -12340,27 +12152,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (cacheItems != null)
|
||||
{
|
||||
// We need to make sure the asset stored in the bake is available on this server also by its assetid before we map it to a Cacheid.
|
||||
// Copy the baked textures to the sim's assets cache (local only).
|
||||
foreach (WearableCacheItem item in cacheItems)
|
||||
{
|
||||
if (cache.GetCached(item.TextureID.ToString()) == null)
|
||||
{
|
||||
item.TextureAsset.Temporary = true;
|
||||
item.TextureAsset.Local = true;
|
||||
cache.Store(item.TextureAsset);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the cached textures
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
WearableCacheItem item =
|
||||
WearableCacheItem.SearchTextureIndex(cachedtex.WearableData[i].TextureIndex, cacheItems);
|
||||
=======
|
||||
CachedTextureRequest handlerCachedTextureRequest = OnCachedTextureRequest;
|
||||
if (handlerCachedTextureRequest != null)
|
||||
{
|
||||
@@ -12368,7 +12159,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
return true;
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
|
||||
protected bool HandleAgentTextureCached(IClientAPI simclient, Packet packet)
|
||||
{
|
||||
@@ -12408,21 +12200,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
int idx = cachedtex.WearableData[i].TextureIndex;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
<<<<<<< HEAD
|
||||
if (item != null && cachedtex.WearableData[i].ID == item.CacheId)
|
||||
{
|
||||
cachedresp.WearableData[i].TextureID = item.TextureID;
|
||||
=======
|
||||
if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
|
||||
{
|
||||
cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
|
||||
cacheHits++;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -12432,29 +12216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
else
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
// Cached textures not available
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
for (int i = 0; i < maxWearablesLoop; i++)
|
||||
{
|
||||
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
|
||||
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
|
||||
cachedresp.WearableData[i].TextureID = UUID.Zero;
|
||||
<<<<<<< HEAD
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
//UUID.Parse("8334fb6e-c2f5-46ee-807d-a435f61a8d46");
|
||||
cachedresp.WearableData[i].HostName = new byte[0];
|
||||
}
|
||||
}
|
||||
|
||||
m_log.DebugFormat("texture cached: hits {0}", cacheHits);
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
cachedresp.Header.Zerocoded = true;
|
||||
OutPacket(cachedresp, ThrottleOutPacketType.Task);
|
||||
|
||||
|
||||
@@ -96,9 +96,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
set
|
||||
{
|
||||
m_throttleDebugLevel = value;
|
||||
/*
|
||||
m_throttleClient.DebugLevel = m_throttleDebugLevel;
|
||||
foreach (TokenBucket tb in m_throttleCategories)
|
||||
tb.DebugLevel = m_throttleDebugLevel;
|
||||
*/
|
||||
}
|
||||
}
|
||||
private int m_throttleDebugLevel;
|
||||
@@ -250,22 +252,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (maxRTO != 0)
|
||||
m_maxRTO = maxRTO;
|
||||
|
||||
<<<<<<< HEAD
|
||||
ProcessUnackedSends = true;
|
||||
|
||||
// Create a token bucket throttle for this client that has the scene token bucket as a parent
|
||||
m_throttleClient
|
||||
= new AdaptiveTokenBucket(
|
||||
string.Format("adaptive throttle for {0} in {1}", AgentID, server.Scene.Name),
|
||||
parentThrottle, 0, rates.Total, rates.MinimumAdaptiveThrottleRate, rates.AdaptiveThrottlesEnabled);
|
||||
|
||||
=======
|
||||
m_burstTime = rates.BrustTime;
|
||||
float m_burst = rates.ClientMaxRate * m_burstTime;
|
||||
|
||||
// Create a token bucket throttle for this client that has the scene token bucket as a parent
|
||||
m_throttleClient = new AdaptiveTokenBucket(parentThrottle, rates.ClientMaxRate, m_burst, rates.AdaptiveThrottlesEnabled);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
// Create an array of token buckets for this clients different throttle categories
|
||||
m_throttleCategories = new TokenBucket[THROTTLE_CATEGORY_COUNT];
|
||||
|
||||
@@ -278,19 +270,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
ThrottleOutPacketType type = (ThrottleOutPacketType)i;
|
||||
|
||||
// Initialize the packet outboxes, where packets sit while they are waiting for tokens
|
||||
<<<<<<< HEAD
|
||||
m_packetOutboxes[i] = new OpenSim.Framework.LocklessQueue<OutgoingPacket>();
|
||||
|
||||
// Initialize the token buckets that control the throttling for each category
|
||||
m_throttleCategories[i]
|
||||
= new TokenBucket(
|
||||
string.Format("{0} throttle for {1} in {2}", type, AgentID, server.Scene.Name),
|
||||
m_throttleClient, rates.GetRate(type), 0);
|
||||
=======
|
||||
m_packetOutboxes[i] = new DoubleLocklessQueue<OutgoingPacket>();
|
||||
// Initialize the token buckets that control the throttling for each category
|
||||
m_throttleCategories[i] = new TokenBucket(m_throttleClient, rates.GetRate(type), m_burst);
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
// Default the retransmission timeout to one second
|
||||
@@ -337,12 +319,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_info.assetThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Asset].DripRate;
|
||||
m_info.textureThrottle = (int)m_throttleCategories[(int)ThrottleOutPacketType.Texture].DripRate;
|
||||
m_info.totalThrottle = (int)m_throttleClient.DripRate;
|
||||
<<<<<<< HEAD
|
||||
m_info.targetThrottle = (int)m_throttleClient.TargetDripRate;
|
||||
m_info.maxThrottle = (int)m_throttleClient.MaxDripRate;
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
return m_info;
|
||||
}
|
||||
|
||||
@@ -460,13 +436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
int texture = (int)(BitConverter.ToSingle(adjData, pos) * scale); pos += 4;
|
||||
int asset = (int)(BitConverter.ToSingle(adjData, pos) * scale);
|
||||
|
||||
if (ThrottleDebugLevel > 0)
|
||||
{
|
||||
long total = resend + land + wind + cloud + task + texture + asset;
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
|
||||
AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
|
||||
}
|
||||
|
||||
|
||||
// Make sure none of the throttles are set below our packet MTU,
|
||||
// otherwise a throttle could become permanently clogged
|
||||
@@ -486,32 +456,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// the task queue (e.g. object updates)
|
||||
task = task + (int)(m_cannibalrate * texture);
|
||||
texture = (int)((1 - m_cannibalrate) * texture);
|
||||
<<<<<<< HEAD
|
||||
|
||||
//int total = resend + land + wind + cloud + task + texture + asset;
|
||||
|
||||
if (ThrottleDebugLevel > 0)
|
||||
{
|
||||
long total = resend + land + wind + cloud + task + texture + asset;
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
|
||||
AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
|
||||
}
|
||||
=======
|
||||
|
||||
int total = resend + land + wind + cloud + task + texture + asset;
|
||||
|
||||
float m_burst = total * m_burstTime;
|
||||
|
||||
//m_log.DebugFormat("[LLUDPCLIENT]: {0} is setting throttles. Resend={1}, Land={2}, Wind={3}, Cloud={4}, Task={5}, Texture={6}, Asset={7}, Total={8}",
|
||||
// AgentID, resend, land, wind, cloud, task, texture, asset, total);
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
// Update the token buckets with new throttle values
|
||||
if (m_throttleClient.AdaptiveEnabled)
|
||||
if (ThrottleDebugLevel > 0)
|
||||
{
|
||||
long total = resend + land + wind + cloud + task + texture + asset;
|
||||
m_throttleClient.TargetDripRate = total;
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPCLIENT]: {0} is setting throttles in {1} to Resend={2}, Land={3}, Wind={4}, Cloud={5}, Task={6}, Texture={7}, Asset={8}, TOTAL = {9}",
|
||||
AgentID, m_udpServer.Scene.Name, resend, land, wind, cloud, task, texture, asset, total);
|
||||
}
|
||||
|
||||
TokenBucket bucket;
|
||||
@@ -887,20 +841,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// signature</param>
|
||||
public void FireQueueEmpty(object o)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
// m_log.DebugFormat("[LLUDPCLIENT]: FireQueueEmpty for {0} in {1}", AgentID, m_udpServer.Scene.Name);
|
||||
|
||||
// int start = Environment.TickCount & Int32.MaxValue;
|
||||
// const int MIN_CALLBACK_MS = 30;
|
||||
|
||||
// if (m_udpServer.IsRunningOutbound)
|
||||
// {
|
||||
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
=======
|
||||
ThrottleOutPacketTypeFlags categories = (ThrottleOutPacketTypeFlags)o;
|
||||
QueueEmpty callback = OnQueueEmpty;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
if (callback != null)
|
||||
{
|
||||
|
||||
@@ -473,17 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
#endregion BinaryStats
|
||||
|
||||
<<<<<<< HEAD
|
||||
// FIXME: Can't add info here because don't know scene yet.
|
||||
// m_throttle
|
||||
// = new TokenBucket(
|
||||
// string.Format("server throttle bucket for {0}", Scene.Name), null, sceneThrottleBps);
|
||||
|
||||
Throttle = new TokenBucket("server throttle bucket", null, 0, sceneThrottleBps);
|
||||
|
||||
=======
|
||||
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
|
||||
>>>>>>> avn/ubitvar
|
||||
Throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps * 10e-3f);
|
||||
ThrottleRates = new ThrottleRates(configSource);
|
||||
|
||||
Random rnd = new Random(Util.EnvironmentTickCount());
|
||||
@@ -784,151 +774,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (UsePools)
|
||||
EnablePoolStats();
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
LLUDPServerCommands commands = new LLUDPServerCommands(MainConsole.Instance, this);
|
||||
commands.Register();
|
||||
=======
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug", false, "debug lludp packet",
|
||||
"debug lludp packet [--default] <level> [<avatar-first-name> <avatar-last-name>]",
|
||||
"Turn on packet debugging",
|
||||
"If level > 255 then all incoming and outgoing packets are logged.\n"
|
||||
+ "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
|
||||
+ "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
|
||||
+ "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
|
||||
+ "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n"
|
||||
+ "If level <= 0 then no packets are logged.\n"
|
||||
+ "If --default is specified then the level becomes the default logging level for all subsequent agents.\n"
|
||||
+ "In this case, you cannot also specify an avatar name.\n"
|
||||
+ "If an avatar name is given then only packets from that avatar are logged.",
|
||||
HandlePacketCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug",
|
||||
false,
|
||||
"debug lludp start",
|
||||
"debug lludp start <in|out|all>",
|
||||
"Control LLUDP packet processing.",
|
||||
"No effect if packet processing has already started.\n"
|
||||
+ "in - start inbound processing.\n"
|
||||
+ "out - start outbound processing.\n"
|
||||
+ "all - start in and outbound processing.\n",
|
||||
HandleStartCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug",
|
||||
false,
|
||||
"debug lludp stop",
|
||||
"debug lludp stop <in|out|all>",
|
||||
"Stop LLUDP packet processing.",
|
||||
"No effect if packet processing has already stopped.\n"
|
||||
+ "in - stop inbound processing.\n"
|
||||
+ "out - stop outbound processing.\n"
|
||||
+ "all - stop in and outbound processing.\n",
|
||||
HandleStopCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug",
|
||||
false,
|
||||
"debug lludp pool",
|
||||
"debug lludp pool <on|off>",
|
||||
"Turn object pooling within the lludp component on or off.",
|
||||
HandlePoolCommand);
|
||||
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug",
|
||||
false,
|
||||
"debug lludp status",
|
||||
"debug lludp status",
|
||||
"Return status of LLUDP packet processing.",
|
||||
HandleStatusCommand);
|
||||
/* disabled
|
||||
MainConsole.Instance.Commands.AddCommand(
|
||||
"Debug",
|
||||
false,
|
||||
"debug lludp toggle agentupdate",
|
||||
"debug lludp toggle agentupdate",
|
||||
"Toggle whether agentupdate packets are processed or simply discarded.",
|
||||
HandleAgentUpdateCommand);
|
||||
*/
|
||||
}
|
||||
|
||||
private void HandlePacketCommand(string module, string[] args)
|
||||
{
|
||||
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
|
||||
return;
|
||||
|
||||
bool setAsDefaultLevel = false;
|
||||
OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null);
|
||||
List<string> filteredArgs = optionSet.Parse(args);
|
||||
|
||||
string name = null;
|
||||
|
||||
if (filteredArgs.Count == 6)
|
||||
{
|
||||
if (!setAsDefaultLevel)
|
||||
{
|
||||
name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (filteredArgs.Count > 3)
|
||||
{
|
||||
int newDebug;
|
||||
if (int.TryParse(filteredArgs[3], out newDebug))
|
||||
{
|
||||
if (setAsDefaultLevel)
|
||||
{
|
||||
DefaultClientPacketDebugLevel = newDebug;
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Debug packet debug for new clients set to {0} in {1}", DefaultClientPacketDebugLevel, m_scene.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scene.ForEachScenePresence(sp =>
|
||||
{
|
||||
if (name == null || sp.Name == name)
|
||||
{
|
||||
MainConsole.Instance.OutputFormat(
|
||||
"Packet debug for {0} ({1}) set to {2} in {3}",
|
||||
sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name);
|
||||
|
||||
sp.ControllingClient.DebugPacketLevel = newDebug;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [<first-name> <last-name>]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleStartCommand(string module, string[] args)
|
||||
{
|
||||
if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene)
|
||||
return;
|
||||
|
||||
if (args.Length != 4)
|
||||
{
|
||||
MainConsole.Instance.Output("Usage: debug lludp start <in|out|all>");
|
||||
return;
|
||||
}
|
||||
|
||||
string subCommand = args[3];
|
||||
|
||||
if (subCommand == "in" || subCommand == "all")
|
||||
StartInbound();
|
||||
|
||||
if (subCommand == "out" || subCommand == "all")
|
||||
StartOutbound();
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
public bool HandlesRegion(Location x)
|
||||
@@ -1126,36 +975,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// If a Linden Lab 1.23.5 client receives an update packet after a kill packet for an object, it will
|
||||
// continue to display the deleted object until relog. Therefore, we need to always queue a kill object
|
||||
// packet so that it isn't sent before a queued update packet.
|
||||
<<<<<<< HEAD
|
||||
bool forceQueue = (type == PacketType.KillObject);
|
||||
|
||||
// if (type == PacketType.ImprovedTerseObjectUpdate)
|
||||
// {
|
||||
// m_log.DebugFormat("Direct send ITOU to {0} in {1}", udpClient.AgentID, Scene.Name);
|
||||
// SendPacketFinal(outgoingPacket);
|
||||
// return false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, forceQueue))
|
||||
=======
|
||||
bool requestQueue = type == PacketType.KillObject;
|
||||
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket, requestQueue, highPriority))
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
SendPacketFinal(outgoingPacket);
|
||||
return true;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// }
|
||||
=======
|
||||
|
||||
return false;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
#endregion Queue or Send
|
||||
}
|
||||
@@ -1462,7 +1290,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
// If there is already a client for this endpoint, don't process UseCircuitCode
|
||||
IClientAPI client = null;
|
||||
if (!m_scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
|
||||
if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
|
||||
{
|
||||
// UseCircuitCode handling
|
||||
if (packet.Type == PacketType.UseCircuitCode)
|
||||
@@ -1473,12 +1301,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
if (m_pendingCache.Contains(endPoint))
|
||||
return;
|
||||
|
||||
<<<<<<< HEAD
|
||||
Util.FireAndForget(HandleUseCircuitCode, array, "LLUDPServer.HandleUseCircuitCode");
|
||||
=======
|
||||
m_pendingCache.AddOrUpdate(endPoint, new Queue<UDPPacketBuffer>(), 60);
|
||||
}
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
|
||||
// buffer.
|
||||
@@ -1507,14 +1331,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Send ack straight away to let the viewer know that we got it.
|
||||
SendAckImmediate(endPoint, packet.Header.Sequence);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Util.FireAndForget(
|
||||
HandleCompleteMovementIntoRegion, array, "LLUDPServer.HandleCompleteMovementIntoRegion");
|
||||
=======
|
||||
// We need to copy the endpoint so that it doesn't get changed when another thread reuses the
|
||||
// buffer.
|
||||
object[] array = new object[] { new IPEndPoint(endPoint.Address, endPoint.Port), packet };
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
Util.FireAndForget(HandleCompleteMovementIntoRegion, array);
|
||||
|
||||
@@ -1524,12 +1343,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Determine which agent this packet came from
|
||||
<<<<<<< HEAD
|
||||
IClientAPI client;
|
||||
if (!Scene.TryGetClient(endPoint, out client) || !(client is LLClientView))
|
||||
=======
|
||||
if (client == null || !(client is LLClientView))
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
//m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName);
|
||||
|
||||
@@ -1547,7 +1361,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
if (!udpClient.IsConnected)
|
||||
{
|
||||
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + m_scene.RegionInfo.RegionName);
|
||||
m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet for a unConnected client in " + Scene.RegionInfo.RegionName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1652,28 +1466,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
LogPacketHeader(true, udpClient.CircuitCode, 0, packet.Type, (ushort)packet.Length);
|
||||
#endregion BinaryStats
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (packet.Type == PacketType.AgentUpdate)
|
||||
{
|
||||
if (DiscardInboundAgentUpdates)
|
||||
return;
|
||||
|
||||
((LLClientView)client).TotalAgentUpdates++;
|
||||
//Ubit AgentUpdate mess removed from here
|
||||
|
||||
AgentUpdatePacket agentUpdate = (AgentUpdatePacket)packet;
|
||||
|
||||
LLClientView llClient = client as LLClientView;
|
||||
if (agentUpdate.AgentData.SessionID != client.SessionId
|
||||
|| agentUpdate.AgentData.AgentID != client.AgentId
|
||||
|| !(llClient == null || llClient.CheckAgentUpdateSignificance(agentUpdate.AgentData)) )
|
||||
{
|
||||
PacketPool.Instance.ReturnPacket(packet);
|
||||
return;
|
||||
}
|
||||
}
|
||||
=======
|
||||
// AgentUpdate mess removed from here
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
#region Ping Check Handling
|
||||
|
||||
@@ -1853,7 +1648,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
AuthenticateResponse sessionInfo;
|
||||
if (IsClientAuthorized(uccp, out sessionInfo))
|
||||
{
|
||||
AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
|
||||
AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
|
||||
|
||||
// Begin the process of adding the client to the simulator
|
||||
client
|
||||
@@ -1868,7 +1663,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// an existing child agent, and there is no circuit data
|
||||
if (client != null && aCircuit == null)
|
||||
{
|
||||
m_scene.CloseAgent(client.AgentId, true);
|
||||
Scene.CloseAgent(client.AgentId, true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1908,14 +1703,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// We only want to send initial data to new clients, not ones which are being converted from child to root.
|
||||
if (client != null)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
AgentCircuitData aCircuit = Scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code);
|
||||
=======
|
||||
>>>>>>> avn/ubitvar
|
||||
bool tp = (aCircuit.teleportFlags > 0);
|
||||
// Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from
|
||||
if (!tp && !client.SceneAgent.SentInitialDataToClient)
|
||||
client.SceneAgent.SendInitialDataToClient();
|
||||
if (!tp)
|
||||
client.SceneAgent.SendInitialDataToMe();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1923,17 +1714,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// Don't create clients for unauthorized requesters.
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: Ignoring connection request for {0} to {1} with unknown circuit code {2} from IP {3}",
|
||||
<<<<<<< HEAD
|
||||
|
||||
uccp.CircuitCode.ID, Scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
|
||||
}
|
||||
|
||||
=======
|
||||
uccp.CircuitCode.ID, m_scene.RegionInfo.RegionName, uccp.CircuitCode.Code, endPoint);
|
||||
|
||||
lock (m_pendingCache)
|
||||
m_pendingCache.Remove(endPoint);
|
||||
}
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[LLUDPSERVER]: Handling UseCircuitCode request from {0} took {1}ms",
|
||||
// buffer.RemoteEndPoint, (DateTime.Now - startTime).Milliseconds);
|
||||
@@ -2127,24 +1914,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
if (!Scene.TryGetClient(agentID, out client))
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
=======
|
||||
createNew = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (client.SceneAgent == null)
|
||||
{
|
||||
m_scene.CloseAgent(agentID, true);
|
||||
Scene.CloseAgent(agentID, true);
|
||||
createNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (createNew)
|
||||
{
|
||||
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
>>>>>>> avn/ubitvar
|
||||
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, Throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
|
||||
|
||||
|
||||
client = new LLClientView(Scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
|
||||
client.OnLogout += LogoutHandler;
|
||||
@@ -2174,29 +1958,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
ClientLogoutsDueToNoReceives++;
|
||||
|
||||
<<<<<<< HEAD
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
|
||||
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
|
||||
=======
|
||||
if (client.SceneAgent != null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LLUDPSERVER]: No packets received from {0} agent of {1} for {2}ms in {3}. Disconnecting.",
|
||||
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, m_scene.Name);
|
||||
>>>>>>> avn/ubitvar
|
||||
client.SceneAgent.IsChildAgent ? "child" : "root", client.Name, timeoutTicks, Scene.Name);
|
||||
|
||||
if (!client.SceneAgent.IsChildAgent)
|
||||
client.Kick("Simulator logged you out due to connection timeout.");
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
Scene.CloseAgent(client.AgentId, true);
|
||||
=======
|
||||
if (!m_scene.CloseAgent(client.AgentId, true))
|
||||
if (!Scene.CloseAgent(client.AgentId, true))
|
||||
client.Close(true,true);
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
private void IncomingPacketHandler()
|
||||
@@ -2209,7 +1983,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (IsRunningInbound)
|
||||
{
|
||||
m_scene.ThreadAlive(1);
|
||||
Scene.ThreadAlive(1);
|
||||
try
|
||||
{
|
||||
IncomingPacket incomingPacket = null;
|
||||
@@ -2261,7 +2035,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
while (base.IsRunningOutbound)
|
||||
{
|
||||
m_scene.ThreadAlive(2);
|
||||
Scene.ThreadAlive(2);
|
||||
try
|
||||
{
|
||||
m_packetSent = false;
|
||||
@@ -2524,15 +2298,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_currentIncomingClient = null;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
|
||||
packet.Type, client.Name, Scene.RegionInfo.RegionName);
|
||||
}
|
||||
=======
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
@@ -2540,7 +2305,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// "[LLUDPSERVER]: Dropped incoming {0} for dead client {1} in {2}",
|
||||
// packet.Type, client.Name, m_scene.RegionInfo.RegionName);
|
||||
// }
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
IncomingPacketsProcessed++;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||
cdl.AddRow("Adaptive throttles", m_udpServer.ThrottleRates.AdaptiveThrottlesEnabled);
|
||||
|
||||
long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate;
|
||||
long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
|
||||
cdl.AddRow(
|
||||
"Max scene throttle",
|
||||
maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
|
||||
@@ -505,7 +505,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_console.OutputFormat("Debug settings for {0}", m_udpServer.Scene.Name);
|
||||
ConsoleDisplayList cdl = new ConsoleDisplayList();
|
||||
|
||||
long maxSceneDripRate = m_udpServer.Throttle.MaxDripRate;
|
||||
long maxSceneDripRate = (long)m_udpServer.Throttle.MaxDripRate;
|
||||
cdl.AddRow(
|
||||
"max-scene-throttle",
|
||||
maxSceneDripRate != 0 ? string.Format("{0} kbps", maxSceneDripRate * 8 / 1000) : "unset");
|
||||
|
||||
@@ -35,6 +35,7 @@ using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
{
|
||||
/*
|
||||
[TestFixture]
|
||||
public class ThrottleTests : OpenSimTestCase
|
||||
{
|
||||
@@ -57,16 +58,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
[Test]
|
||||
public void TestSetRequestDripRate()
|
||||
{
|
||||
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TokenBucket tb = new TokenBucket("tb", null, 5000, 0);
|
||||
TokenBucket tb = new TokenBucket(null, 5000f,10000f);
|
||||
AssertRates(tb, 5000, 0, 5000, 0);
|
||||
|
||||
tb.RequestedDripRate = 4000;
|
||||
tb.RequestedDripRate = 4000f;
|
||||
AssertRates(tb, 4000, 0, 4000, 0);
|
||||
|
||||
tb.RequestedDripRate = 6000;
|
||||
AssertRates(tb, 6000, 0, 6000, 0);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -74,7 +77,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TokenBucket tb = new TokenBucket("tb", null, 5000, 10000);
|
||||
TokenBucket tb = new TokenBucket(null, 5000,15000);
|
||||
AssertRates(tb, 5000, 0, 5000, 10000);
|
||||
|
||||
tb.RequestedDripRate = 4000;
|
||||
@@ -92,9 +95,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TokenBucket tbParent = new TokenBucket("tbParent", null, 0, 0);
|
||||
TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000, 0);
|
||||
TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000, 0);
|
||||
TokenBucket tbParent = new TokenBucket("tbParent", null, 0);
|
||||
TokenBucket tbChild1 = new TokenBucket("tbChild1", tbParent, 3000);
|
||||
TokenBucket tbChild2 = new TokenBucket("tbChild2", tbParent, 5000);
|
||||
|
||||
AssertRates(tbParent, 8000, 8000, 8000, 0);
|
||||
AssertRates(tbChild1, 3000, 0, 3000, 0);
|
||||
@@ -113,6 +116,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
AssertRates(tbParent, 6000, 8000, 6000, 0);
|
||||
AssertRates(tbChild1, 3000, 0, 6000 / 8 * 3, 0);
|
||||
AssertRates(tbChild2, 5000, 0, 6000 / 8 * 5, 0);
|
||||
|
||||
}
|
||||
|
||||
private void AssertRates(
|
||||
@@ -424,4 +428,5 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
|
||||
udpClient.SetThrottles(throttles);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -42,24 +42,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public class TokenBucket
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
<<<<<<< HEAD
|
||||
|
||||
public string Identifier { get; private set; }
|
||||
|
||||
public int DebugLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of ticks (ms) per quantum, drip rate and max burst
|
||||
/// are defined over this interval.
|
||||
/// </summary>
|
||||
protected const Int32 m_ticksPerQuantum = 1000;
|
||||
=======
|
||||
private static Int32 m_counter = 0;
|
||||
|
||||
// private Int32 m_identifier;
|
||||
|
||||
protected const float m_timeScale = 1e-3f;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
/// <summary>
|
||||
/// This is the number of m_minimumDripRate bytes
|
||||
@@ -72,11 +60,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
<<<<<<< HEAD
|
||||
protected const Int32 m_minimumDripRate = LLUDPServer.MTU;
|
||||
=======
|
||||
protected const float m_minimumDripRate = 1400;
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
/// <summary>Time of the last drip, in system ticks</summary>
|
||||
protected Int32 m_lastDrip;
|
||||
@@ -90,27 +74,31 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <summary>
|
||||
/// Map of children buckets and their requested maximum burst rate
|
||||
/// </summary>
|
||||
<<<<<<< HEAD
|
||||
protected Dictionary<TokenBucket,Int64> m_children = new Dictionary<TokenBucket,Int64>();
|
||||
=======
|
||||
|
||||
protected Dictionary<TokenBucket, float> m_children = new Dictionary<TokenBucket, float>();
|
||||
|
||||
#region Properties
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
/// <summary>
|
||||
/// The parent bucket of this bucket, or null if this bucket has no
|
||||
/// parent. The parent bucket will limit the aggregate bandwidth of all
|
||||
/// of its children buckets
|
||||
/// </summary>
|
||||
public TokenBucket Parent { get; protected set; }
|
||||
|
||||
protected TokenBucket m_parent;
|
||||
public TokenBucket Parent
|
||||
{
|
||||
get { return m_parent; }
|
||||
set { m_parent = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// This is the maximum number
|
||||
/// of tokens that can accumulate in the bucket at any one time. This
|
||||
/// also sets the total request for leaf nodes
|
||||
/// </summary>
|
||||
protected float m_burst;
|
||||
//not in use
|
||||
public float MaxDripRate { get; set; }
|
||||
|
||||
public float RequestedBurst
|
||||
{
|
||||
get { return m_burst; }
|
||||
@@ -143,63 +131,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// Can never be above MaxDripRate.
|
||||
/// Tokens are added to the bucket at any time
|
||||
/// <seealso cref="RemoveTokens"/> is called, at the granularity of
|
||||
<<<<<<< HEAD
|
||||
/// the system tick interval (typically around 15-22ms)
|
||||
/// FIXME: It is extremely confusing to be able to set a RequestedDripRate of 0 and then receive a positive
|
||||
/// number on get if TotalDripRequest is set. This also stops us being able to retrieve the fact that
|
||||
/// RequestedDripRate is set to 0. Really, this should always return m_dripRate and then we can get
|
||||
/// (m_dripRate == 0 ? TotalDripRequest : m_dripRate) on some other properties.
|
||||
/// </remarks>
|
||||
public virtual Int64 RequestedDripRate
|
||||
{
|
||||
get { return (m_dripRate == 0 ? TotalDripRequest : m_dripRate); }
|
||||
set
|
||||
{
|
||||
if (value <= 0)
|
||||
m_dripRate = 0;
|
||||
else if (MaxDripRate > 0 && value > MaxDripRate)
|
||||
m_dripRate = MaxDripRate;
|
||||
else
|
||||
m_dripRate = value;
|
||||
|
||||
m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
|
||||
|
||||
if (Parent != null)
|
||||
Parent.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the drip rate.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// DripRate can never be above max drip rate or below min drip rate.
|
||||
/// If we are a child bucket then the drip rate return is modifed by the total load on the capacity of the
|
||||
/// parent bucket.
|
||||
/// </value>
|
||||
public virtual Int64 DripRate
|
||||
{
|
||||
get
|
||||
{
|
||||
double rate;
|
||||
|
||||
// FIXME: This doesn't properly work if we have a parent and children and a requested drip rate set
|
||||
// on ourselves which is not equal to the child drip rates.
|
||||
if (Parent == null)
|
||||
{
|
||||
if (TotalDripRequest > 0)
|
||||
rate = Math.Min(RequestedDripRate, TotalDripRequest);
|
||||
else
|
||||
rate = RequestedDripRate;
|
||||
}
|
||||
else
|
||||
{
|
||||
rate = (double)RequestedDripRate * Parent.DripRateModifier();
|
||||
}
|
||||
|
||||
=======
|
||||
/// the system tick interval (typically around 15-22ms)</remarks>
|
||||
protected float m_dripRate;
|
||||
|
||||
public virtual float RequestedDripRate
|
||||
{
|
||||
get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); }
|
||||
@@ -212,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
}
|
||||
|
||||
public virtual float DripRate
|
||||
public virtual float DripRate
|
||||
{
|
||||
get {
|
||||
float rate = Math.Min(RequestedDripRate,TotalDripRequest);
|
||||
@@ -220,28 +154,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
return rate;
|
||||
|
||||
rate *= m_parent.DripRateModifier();
|
||||
>>>>>>> avn/ubitvar
|
||||
if (rate < m_minimumDripRate)
|
||||
rate = m_minimumDripRate;
|
||||
else if (MaxDripRate > 0 && rate > MaxDripRate)
|
||||
rate = MaxDripRate;
|
||||
|
||||
return (float)rate;
|
||||
}
|
||||
}
|
||||
protected Int64 m_dripRate;
|
||||
|
||||
// <summary>
|
||||
// The maximum rate for flow control. Drip rate can never be greater than this.
|
||||
// </summary>
|
||||
public Int64 MaxDripRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The current total of the requested maximum burst rates of children buckets.
|
||||
/// </summary>
|
||||
<<<<<<< HEAD
|
||||
public Int64 TotalDripRequest { get; protected set; }
|
||||
=======
|
||||
protected float m_totalDripRequest;
|
||||
public float TotalDripRequest
|
||||
{
|
||||
@@ -252,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
#endregion Properties
|
||||
|
||||
#region Constructor
|
||||
>>>>>>> avn/ubitvar
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
@@ -260,36 +182,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// <param name="identifier">Identifier for this token bucket</param>
|
||||
/// <param name="parent">Parent bucket if this is a child bucket, or
|
||||
/// null if this is a root bucket</param>
|
||||
<<<<<<< HEAD
|
||||
/// <param name="requestedDripRate">
|
||||
/// Requested rate that the bucket fills, in bytes per
|
||||
/// second. If zero, the bucket always remains full.
|
||||
/// </param>
|
||||
public TokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate)
|
||||
=======
|
||||
/// <param name="maxBurst">Maximum size of the bucket in bytes, or
|
||||
/// zero if this bucket has no maximum capacity</param>
|
||||
/// <param name="dripRate">Rate that the bucket fills, in bytes per
|
||||
/// second. If zero, the bucket always remains full</param>
|
||||
public TokenBucket(TokenBucket parent, float dripRate, float MaxBurst)
|
||||
>>>>>>> avn/ubitvar
|
||||
{
|
||||
Identifier = identifier;
|
||||
m_counter++;
|
||||
|
||||
Parent = parent;
|
||||
<<<<<<< HEAD
|
||||
RequestedDripRate = requestedDripRate;
|
||||
MaxDripRate = maxDripRate;
|
||||
m_lastDrip = Util.EnvironmentTickCount();
|
||||
=======
|
||||
RequestedDripRate = dripRate;
|
||||
RequestedBurst = MaxBurst;
|
||||
// TotalDripRequest = dripRate; // this will be overwritten when a child node registers
|
||||
// MaxBurst = (Int64)((double)dripRate * m_quantumsPerBurst);
|
||||
m_lastDrip = Util.EnvironmentTickCount() + 100000;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
#endregion Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Compute a modifier for the MaxBurst rate. This is 1.0, meaning
|
||||
/// no modification if the requested bandwidth is less than the
|
||||
@@ -299,20 +209,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
/// </summary>
|
||||
protected float DripRateModifier()
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
Int64 driprate = DripRate;
|
||||
double modifier = driprate >= TotalDripRequest ? 1.0 : (double)driprate / (double)TotalDripRequest;
|
||||
|
||||
// if (DebugLevel > 0)
|
||||
// m_log.DebugFormat(
|
||||
// "[TOKEN BUCKET]: Returning drip modifier {0}/{1} = {2} from {3}",
|
||||
// driprate, TotalDripRequest, modifier, Identifier);
|
||||
|
||||
return modifier;
|
||||
=======
|
||||
float driprate = DripRate;
|
||||
return driprate >= TotalDripRequest ? 1.0f : driprate / TotalDripRequest;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -335,29 +233,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_children[child] = request;
|
||||
|
||||
<<<<<<< HEAD
|
||||
TotalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
|
||||
TotalDripRequest += cref.Value;
|
||||
=======
|
||||
m_totalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, float> cref in m_children)
|
||||
m_totalDripRequest += cref.Value;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (Parent != null)
|
||||
{
|
||||
Int64 effectiveDripRate;
|
||||
|
||||
if (RequestedDripRate > 0)
|
||||
effectiveDripRate = Math.Min(RequestedDripRate, TotalDripRequest);
|
||||
else
|
||||
effectiveDripRate = TotalDripRequest;
|
||||
|
||||
Parent.RegisterRequest(this, effectiveDripRate);
|
||||
}
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -370,15 +253,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_children.Remove(child);
|
||||
|
||||
<<<<<<< HEAD
|
||||
TotalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, Int64> cref in m_children)
|
||||
TotalDripRequest += cref.Value;
|
||||
=======
|
||||
m_totalDripRequest = 0;
|
||||
foreach (KeyValuePair<TokenBucket, float> cref in m_children)
|
||||
m_totalDripRequest += cref.Value;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
@@ -427,7 +304,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
// with no drip rate...
|
||||
if (DripRate == 0)
|
||||
{
|
||||
m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", Identifier);
|
||||
m_log.WarnFormat("[TOKENBUCKET] something odd is happening and drip rate is 0 for {0}", m_counter);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -453,17 +330,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public bool AdaptiveEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
<<<<<<< HEAD
|
||||
/// Target drip rate for this bucket.
|
||||
/// </summary>
|
||||
/// <remarks>Usually set by the client. If adaptive is enabled then throttles will increase until we reach this.</remarks>
|
||||
public Int64 TargetDripRate
|
||||
{
|
||||
get { return m_targetDripRate; }
|
||||
set
|
||||
{
|
||||
m_targetDripRate = Math.Max(value, m_minimumFlow);
|
||||
=======
|
||||
/// The minimum rate for flow control. Minimum drip rate is one
|
||||
/// packet per second.
|
||||
/// </summary>
|
||||
@@ -479,13 +345,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public float MaxDripRate
|
||||
{
|
||||
get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); }
|
||||
set
|
||||
set
|
||||
{
|
||||
m_maxDripRate = (value == 0 ? m_totalDripRequest : Math.Max(value, m_minimumFlow));
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
}
|
||||
protected Int64 m_targetDripRate;
|
||||
|
||||
private bool m_enabled = false;
|
||||
|
||||
// <summary>
|
||||
// Adjust drip rate in response to network conditions.
|
||||
@@ -493,109 +359,50 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public virtual float AdjustedDripRate
|
||||
{
|
||||
get { return m_dripRate; }
|
||||
<<<<<<< HEAD
|
||||
set
|
||||
set
|
||||
{
|
||||
m_dripRate = OpenSim.Framework.Util.Clamp<Int64>(value, m_minimumFlow, TargetDripRate);
|
||||
m_burstRate = (Int64)((double)m_dripRate * m_quantumsPerBurst);
|
||||
|
||||
if (Parent != null)
|
||||
Parent.RegisterRequest(this, m_dripRate);
|
||||
=======
|
||||
set {
|
||||
m_dripRate = OpenSim.Framework.Util.Clamp<float>(value,m_minimumFlow,MaxDripRate);
|
||||
m_dripRate = OpenSim.Framework.Util.Clamp<float>(value, m_minimumFlow, MaxDripRate);
|
||||
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this,m_dripRate);
|
||||
>>>>>>> avn/ubitvar
|
||||
m_parent.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The minimum rate for adaptive flow control.
|
||||
/// </summary>
|
||||
protected Int64 m_minimumFlow = 32000;
|
||||
|
||||
<<<<<<< HEAD
|
||||
/// <summary>
|
||||
/// Constructor for the AdaptiveTokenBucket class
|
||||
/// <param name="identifier">Unique identifier for the client</param>
|
||||
/// <param name="parent">Parent bucket in the hierarchy</param>
|
||||
/// <param name="requestedDripRate"></param>
|
||||
/// <param name="maxDripRate">The ceiling rate for adaptation</param>
|
||||
/// <param name="minDripRate">The floor rate for adaptation</param>
|
||||
/// </summary>
|
||||
public AdaptiveTokenBucket(string identifier, TokenBucket parent, Int64 requestedDripRate, Int64 maxDripRate, Int64 minDripRate, bool enabled)
|
||||
: base(identifier, parent, requestedDripRate, maxDripRate)
|
||||
{
|
||||
AdaptiveEnabled = enabled;
|
||||
|
||||
if (AdaptiveEnabled)
|
||||
{
|
||||
// m_log.DebugFormat("[TOKENBUCKET]: Adaptive throttle enabled");
|
||||
m_minimumFlow = minDripRate;
|
||||
TargetDripRate = m_minimumFlow;
|
||||
AdjustedDripRate = m_minimumFlow;
|
||||
}
|
||||
=======
|
||||
|
||||
// <summary>
|
||||
//
|
||||
// </summary>
|
||||
public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate,float maxBurst, bool enabled)
|
||||
: base(parent, maxDripRate,maxBurst)
|
||||
public AdaptiveTokenBucket(TokenBucket parent, float maxDripRate, float maxBurst, bool enabled)
|
||||
: base(parent, maxDripRate, maxBurst)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
|
||||
|
||||
MaxDripRate = maxDripRate;
|
||||
|
||||
if (enabled)
|
||||
AdjustedDripRate = m_maxDripRate * .5f;
|
||||
else
|
||||
AdjustedDripRate = m_maxDripRate;
|
||||
>>>>>>> avn/ubitvar
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reliable packets sent to the client for which we never received an ack adjust the drip rate down.
|
||||
/// <param name="packets">Number of packets that expired without successful delivery</param>
|
||||
/// </summary>
|
||||
public void ExpirePackets(Int32 packets)
|
||||
public void ExpirePackets(Int32 count)
|
||||
{
|
||||
if (AdaptiveEnabled)
|
||||
{
|
||||
if (DebugLevel > 0)
|
||||
m_log.WarnFormat(
|
||||
"[ADAPTIVEBUCKET] drop {0} by {1} expired packets for {2}",
|
||||
AdjustedDripRate, packets, Identifier);
|
||||
|
||||
// AdjustedDripRate = (Int64) (AdjustedDripRate / Math.Pow(2,packets));
|
||||
|
||||
// Compute the fallback solely on the rate allocated beyond the minimum, this
|
||||
// should smooth out the fallback to the minimum rate
|
||||
AdjustedDripRate = m_minimumFlow + (Int64) ((AdjustedDripRate - m_minimumFlow) / Math.Pow(2, packets));
|
||||
}
|
||||
// m_log.WarnFormat("[ADAPTIVEBUCKET] drop {0} by {1} expired packets",AdjustedDripRate,count);
|
||||
if (m_enabled)
|
||||
AdjustedDripRate = (Int64)(AdjustedDripRate / Math.Pow(2, count));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reliable packets acked by the client adjust the drip rate up.
|
||||
/// <param name="packets">Number of packets successfully acknowledged</param>
|
||||
/// </summary>
|
||||
public void AcknowledgePackets(Int32 packets)
|
||||
// <summary>
|
||||
//
|
||||
// </summary>
|
||||
public void AcknowledgePackets(Int32 count)
|
||||
{
|
||||
if (AdaptiveEnabled)
|
||||
AdjustedDripRate = AdjustedDripRate + packets * LLUDPServer.MTU;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adjust the minimum flow level for the adaptive throttle, this will drop adjusted
|
||||
/// throttles back to the minimum levels
|
||||
/// <param>minDripRate--the new minimum flow</param>
|
||||
/// </summary>
|
||||
public void ResetMinimumAdaptiveFlow(Int64 minDripRate)
|
||||
{
|
||||
m_minimumFlow = minDripRate;
|
||||
TargetDripRate = m_minimumFlow;
|
||||
AdjustedDripRate = m_minimumFlow;
|
||||
if (m_enabled)
|
||||
AdjustedDripRate = AdjustedDripRate + count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,11 +141,6 @@ namespace OpenSim.Region.ClientStack
|
||||
PhysicsPluginManager physicsPluginManager;
|
||||
physicsPluginManager = new PhysicsPluginManager();
|
||||
physicsPluginManager.LoadPluginsFromAssemblies("Physics");
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> avn/ubitvar
|
||||
return physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user