Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

0.6.8-post-fixes
John Hurliman 2009-11-04 16:08:23 -08:00
commit f57a646638
16 changed files with 141 additions and 176 deletions

View File

@ -1052,7 +1052,7 @@ namespace OpenSim.Client.MXP.ClientStack
{
}
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, bool fetchFolders, bool fetchItems)
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int version, bool fetchFolders, bool fetchItems)
{
// Need to translate to MXP somehow
}

View File

@ -606,7 +606,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException();
}
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, bool fetchFolders, bool fetchItems)
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int version, bool fetchFolders, bool fetchItems)
{
throw new System.NotImplementedException();
}

View File

@ -208,7 +208,7 @@ namespace OpenSim.Framework.Capabilities
// As of RC 1.22.9 of the Linden client this is
// supported
m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
//m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
// justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
// subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires

View File

@ -679,7 +679,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="fetchFolders"></param>
/// <param name="fetchItems"></param>
/// <returns>true if the request was queued or successfully processed, false otherwise</returns>
public bool SendInventoryDecendents(IClientAPI client, UUID folderID, bool fetchFolders, bool fetchItems)
public bool SendInventoryDecendents(IClientAPI client, UUID folderID, int version, bool fetchFolders, bool fetchItems)
{
if (m_hasReceivedInventory)
{
@ -693,7 +693,7 @@ namespace OpenSim.Framework.Communications.Cache
client.SendInventoryFolderDetails(
client.AgentId, folderID, folder.RequestListOfItems(),
folder.RequestListOfFolders(), fetchFolders, fetchItems);
folder.RequestListOfFolders(), version, fetchFolders, fetchItems);
return true;
}

View File

@ -1124,7 +1124,7 @@ namespace OpenSim.Framework
void ReprioritizeUpdates(StateUpdateTypes type, UpdatePriorityHandler handler);
void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders, bool fetchFolders,
List<InventoryFolderBase> folders, int version, bool fetchFolders,
bool fetchItems);
void FlushPrimUpdates();

View File

@ -1251,7 +1251,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="fetchFolders">Do we need to send folder information?</param>
/// <param name="fetchItems">Do we need to send item information?</param>
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items,
List<InventoryFolderBase> folders,
List<InventoryFolderBase> folders, int version,
bool fetchFolders, bool fetchItems)
{
// An inventory descendents packet consists of a single agent section and an inventory details
@ -1266,172 +1266,104 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// 6 to 7 items at a time, so let's stick with 6
int MAX_ITEMS_PER_PACKET = 6;
//Ckrinke This variable is not used, so comment out to remove the warning from the compiler (3-21-08)
//Ckrinke uint FULL_MASK_PERMISSIONS = 2147483647;
int totalItems = fetchItems ? items.Count : 0;
int totalFolders = fetchFolders ? folders.Count : 0;
int itemsSent = 0;
if (fetchItems)
{
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
int foldersSent = 0;
int foldersToSend = 0;
int itemsToSend = 0;
if (items.Count < MAX_ITEMS_PER_PACKET)
InventoryDescendentsPacket currentPacket = null;
// Handle empty folders
//
if (totalItems == 0 && totalFolders == 0)
currentPacket = CreateInventoryDescendentsPacket(ownerID, folderID, version, items.Count + folders.Count, 0, 0);
// To preserve SL compatibility, we will NOT combine folders and items in one packet
//
while(itemsSent < totalItems || foldersSent < totalFolders)
{
if (currentPacket == null) // Start a new packet
{
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count];
foldersToSend = totalFolders - foldersSent;
if (foldersToSend > MAX_ITEMS_PER_PACKET)
foldersToSend = MAX_ITEMS_PER_PACKET;
if (foldersToSend == 0)
{
itemsToSend = totalItems - itemsSent;
if (itemsToSend > MAX_ITEMS_PER_PACKET)
itemsToSend = MAX_ITEMS_PER_PACKET;
}
currentPacket = CreateInventoryDescendentsPacket(ownerID, folderID, version, items.Count + folders.Count, foldersToSend, itemsToSend);
}
if (foldersToSend-- > 0)
currentPacket.FolderData[foldersSent % MAX_ITEMS_PER_PACKET] = CreateFolderDataBlock(folders[foldersSent++]);
else if(itemsToSend-- > 0)
currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]);
else
{
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
currentPacket = null;
}
// Descendents must contain the *total* number of descendents (plus folders, whether we
// fetch them or not), not the number of entries we send in this packet. For consistency,
// I'll use it for folder-requests, too, although I wasn't able to get one with
// FetchFolders = true.
// TODO this should be checked with FetchFolders = true
descend.AgentData.Descendents = items.Count + folders.Count;
int count = 0;
int i = 0;
foreach (InventoryItemBase item in items)
{
descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock();
descend.ItemData[i].ItemID = item.ID;
descend.ItemData[i].AssetID = item.AssetID;
descend.ItemData[i].CreatorID = item.CreatorIdAsUuid;
descend.ItemData[i].BaseMask = item.BasePermissions;
descend.ItemData[i].Description = Util.StringToBytes256(item.Description);
descend.ItemData[i].EveryoneMask = item.EveryOnePermissions;
descend.ItemData[i].OwnerMask = item.CurrentPermissions;
descend.ItemData[i].FolderID = item.Folder;
descend.ItemData[i].InvType = (sbyte)item.InvType;
descend.ItemData[i].Name = Util.StringToBytes256(item.Name);
descend.ItemData[i].NextOwnerMask = item.NextPermissions;
descend.ItemData[i].OwnerID = item.Owner;
descend.ItemData[i].Type = (sbyte)item.AssetType;
descend.ItemData[i].GroupID = item.GroupID;
descend.ItemData[i].GroupOwned = item.GroupOwned;
descend.ItemData[i].GroupMask = item.GroupPermissions;
descend.ItemData[i].CreationDate = item.CreationDate;
descend.ItemData[i].SalePrice = item.SalePrice;
descend.ItemData[i].SaleType = item.SaleType;
descend.ItemData[i].Flags = item.Flags;
descend.ItemData[i].CRC =
Helpers.InventoryCRC(descend.ItemData[i].CreationDate, descend.ItemData[i].SaleType,
descend.ItemData[i].InvType, descend.ItemData[i].Type,
descend.ItemData[i].AssetID, descend.ItemData[i].GroupID,
descend.ItemData[i].SalePrice,
descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID,
descend.ItemData[i].ItemID, descend.ItemData[i].FolderID,
descend.ItemData[i].EveryoneMask,
descend.ItemData[i].Flags, descend.ItemData[i].OwnerMask,
descend.ItemData[i].GroupMask, item.CurrentPermissions);
i++;
count++;
itemsSent++;
if (i == MAX_ITEMS_PER_PACKET)
{
descend.Header.Zerocoded = true;
AddNullFolderBlockToDecendentsPacket(ref descend);
OutPacket(descend, ThrottleOutPacketType.Asset);
if ((items.Count - count) > 0)
{
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if ((items.Count - count) < MAX_ITEMS_PER_PACKET)
{
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count - count];
}
else
{
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[MAX_ITEMS_PER_PACKET];
}
descend.AgentData.Descendents = items.Count + folders.Count;
i = 0;
}
}
}
if (0 < i && i < MAX_ITEMS_PER_PACKET)
{
AddNullFolderBlockToDecendentsPacket(ref descend);
OutPacket(descend, ThrottleOutPacketType.Asset);
}
}
//send subfolders
if (fetchFolders)
{
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if (currentPacket != null)
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
}
if (folders.Count < MAX_ITEMS_PER_PACKET)
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders.Count];
}
else
{
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
}
private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder)
{
InventoryDescendentsPacket.FolderDataBlock newBlock = new InventoryDescendentsPacket.FolderDataBlock();
newBlock.FolderID = folder.ID;
newBlock.Name = Util.StringToBytes256(folder.Name);
newBlock.ParentID = folder.ParentID;
newBlock.Type = (sbyte)folder.Type;
// Not sure if this scenario ever actually occurs, but nonetheless we include the items
// count even if we're not sending item data for the same reasons as above.
descend.AgentData.Descendents = items.Count + folders.Count;
return newBlock;
}
int i = 0;
int count = 0;
foreach (InventoryFolderBase folder in folders)
{
descend.FolderData[i] = new InventoryDescendentsPacket.FolderDataBlock();
descend.FolderData[i].FolderID = folder.ID;
descend.FolderData[i].Name = Util.StringToBytes256(folder.Name);
descend.FolderData[i].ParentID = folder.ParentID;
descend.FolderData[i].Type = (sbyte)folder.Type;
private InventoryDescendentsPacket.ItemDataBlock CreateItemDataBlock(InventoryItemBase item)
{
InventoryDescendentsPacket.ItemDataBlock newBlock = new InventoryDescendentsPacket.ItemDataBlock();
newBlock.ItemID = item.ID;
newBlock.AssetID = item.AssetID;
newBlock.CreatorID = item.CreatorIdAsUuid;
newBlock.BaseMask = item.BasePermissions;
newBlock.Description = Util.StringToBytes256(item.Description);
newBlock.EveryoneMask = item.EveryOnePermissions;
newBlock.OwnerMask = item.CurrentPermissions;
newBlock.FolderID = item.Folder;
newBlock.InvType = (sbyte)item.InvType;
newBlock.Name = Util.StringToBytes256(item.Name);
newBlock.NextOwnerMask = item.NextPermissions;
newBlock.OwnerID = item.Owner;
newBlock.Type = (sbyte)item.AssetType;
i++;
count++;
itemsSent++;
if (i == MAX_ITEMS_PER_PACKET)
{
AddNullItemBlockToDescendentsPacket(ref descend);
OutPacket(descend, ThrottleOutPacketType.Asset);
newBlock.GroupID = item.GroupID;
newBlock.GroupOwned = item.GroupOwned;
newBlock.GroupMask = item.GroupPermissions;
newBlock.CreationDate = item.CreationDate;
newBlock.SalePrice = item.SalePrice;
newBlock.SaleType = item.SaleType;
newBlock.Flags = item.Flags;
if ((folders.Count - count) > 0)
{
descend = CreateInventoryDescendentsPacket(ownerID, folderID);
if ((folders.Count - count) < MAX_ITEMS_PER_PACKET)
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[folders.Count - count];
}
else
{
descend.FolderData =
new InventoryDescendentsPacket.FolderDataBlock[MAX_ITEMS_PER_PACKET];
}
descend.AgentData.Descendents = items.Count + folders.Count;
i = 0;
}
}
}
newBlock.CRC =
Helpers.InventoryCRC(newBlock.CreationDate, newBlock.SaleType,
newBlock.InvType, newBlock.Type,
newBlock.AssetID, newBlock.GroupID,
newBlock.SalePrice,
newBlock.OwnerID, newBlock.CreatorID,
newBlock.ItemID, newBlock.FolderID,
newBlock.EveryoneMask,
newBlock.Flags, newBlock.OwnerMask,
newBlock.GroupMask, newBlock.NextOwnerMask);
if (0 < i && i < MAX_ITEMS_PER_PACKET)
{
AddNullItemBlockToDescendentsPacket(ref descend);
OutPacket(descend, ThrottleOutPacketType.Asset);
}
}
if (itemsSent == 0)
{
// no items found.
InventoryDescendentsPacket descend = CreateInventoryDescendentsPacket(ownerID, folderID);
descend.AgentData.Descendents = 0;
AddNullItemBlockToDescendentsPacket(ref descend);
AddNullFolderBlockToDecendentsPacket(ref descend);
OutPacket(descend, ThrottleOutPacketType.Asset);
}
return newBlock;
}
private void AddNullFolderBlockToDecendentsPacket(ref InventoryDescendentsPacket packet)
@ -1473,14 +1405,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// No need to add CRC
}
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(UUID ownerID, UUID folderID)
private InventoryDescendentsPacket CreateInventoryDescendentsPacket(UUID ownerID, UUID folderID, int version, int descendents, int folders, int items)
{
InventoryDescendentsPacket descend = (InventoryDescendentsPacket)PacketPool.Instance.GetPacket(PacketType.InventoryDescendents);
descend.Header.Zerocoded = true;
descend.AgentData.AgentID = AgentId;
descend.AgentData.OwnerID = ownerID;
descend.AgentData.FolderID = folderID;
descend.AgentData.Version = 1;
descend.AgentData.Version = version;
descend.AgentData.Descendents = descendents;
if (folders > 0)
descend.FolderData = new InventoryDescendentsPacket.FolderDataBlock[folders];
else
AddNullFolderBlockToDecendentsPacket(ref descend);
if (items > 0)
descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items];
else
AddNullItemBlockToDescendentsPacket(ref descend);
return descend;
}
@ -4963,6 +4906,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, true);
}
/// <summary>
/// This is the starting point for sending a simulator packet out to the client
/// </summary>
/// <param name="packet">Packet to send</param>
/// <param name="throttlePacketType">Throttling category for the packet</param>
/// <param name="doAutomaticSplitting">True to automatically split oversized
/// packets (the default), or false to disable splitting if the calling code
/// handles splitting manually</param>
protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting)
{
m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
}
public bool AddMoney(int debit)
{
if (m_moneyBalance + debit >= 0)

View File

@ -327,7 +327,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting
// there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here
// to accomodate for both common scenarios and provide ample room for ACK appending in both
int bufferSize = (dataLength > 180) ? LLUDPServer.MTU : 200;
int bufferSize = (dataLength > 180) ? LLUDPServer.MTU + 1000 : 200;
UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);

View File

@ -538,6 +538,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,
int version,
bool fetchFolders,
bool fetchItems)
{

View File

@ -77,13 +77,13 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
#region Internal functions
private string UserAssetURL(UUID userID)
{
CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
if (uinfo != null)
return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI;
return null;
}
// private string UserAssetURL(UUID userID)
// {
// CachedUserInfo uinfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(userID);
// if (uinfo != null)
// return (uinfo.UserProfile.UserAssetURI == "") ? null : uinfo.UserProfile.UserAssetURI;
// return null;
// }
// private string UserInventoryURL(UUID userID)
// {

View File

@ -1175,7 +1175,13 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.DebugFormat("[AGENT INVENTORY]: Send Inventory Folder {0} Update to {1} {2}", folder.Name, client.FirstName, client.LastName);
InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, fetchFolders, fetchItems);
InventoryFolderBase containingFolder = new InventoryFolderBase();
containingFolder.ID = folder.ID;
containingFolder.Owner = client.AgentId;
containingFolder = InventoryService.GetFolder(containingFolder);
int version = containingFolder.Version;
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, version, fetchFolders, fetchItems);
}
/// <summary>

View File

@ -462,7 +462,7 @@ namespace OpenSim.Region.Framework.Scenes
{
remoteClient.SendInventoryFolderDetails(
fold.Owner, folderID, fold.RequestListOfItems(),
fold.RequestListOfFolders(), fetchFolders, fetchItems);
fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
return;
}

View File

@ -1043,7 +1043,7 @@ namespace OpenSim.Region.Framework.Scenes
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
physicsFPS = 0f;
maintc = maintc = otherMS = Environment.TickCount;
maintc = otherMS = Environment.TickCount;
int tmpFrameMS = maintc;
// Increment the frame counter

View File

@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 };
private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
// private static readonly byte[] DEFAULT_TEXTURE = AvatarAppearance.GetDefaultTexture().GetBytes();
private static readonly Array DIR_CONTROL_FLAGS = Enum.GetValues(typeof(Dir_ControlFlags));
private static readonly Vector3 HEAD_ADJUSTMENT = new Vector3(0f, 0f, 0.3f);
/// <summary>
@ -181,7 +181,7 @@ namespace OpenSim.Region.Framework.Scenes
private byte m_state;
//Reuse the Vector3 instead of creating a new one on the UpdateMovement method
private Vector3 movementvector;
// private Vector3 movementvector;
private bool m_autopilotMoving;
private Vector3 m_autoPilotTarget;
@ -2074,7 +2074,7 @@ namespace OpenSim.Region.Framework.Scenes
if (heldDown) { move.Z -= 1; }
// Is the avatar trying to move?
bool moving = (move != Vector3.Zero);
// bool moving = (move != Vector3.Zero);
bool jumping = m_animTickJump != 0;
#endregion Inputs
@ -2326,7 +2326,7 @@ namespace OpenSim.Region.Framework.Scenes
if (m_isChildAgent == false)
{
PhysicsActor actor = m_physicsActor;
// PhysicsActor actor = m_physicsActor;
// NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
// grab the latest PhysicsActor velocity, whereas m_velocity is often
@ -3262,7 +3262,7 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 force = m_forceToApply.Value;
m_updateflag = true;
movementvector = force;
// movementvector = force;
Velocity = force;
m_forceToApply = null;

View File

@ -1055,7 +1055,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, bool fetchFolders, bool fetchItems)
public void SendInventoryFolderDetails(UUID ownerID, UUID folderID, List<InventoryItemBase> items, List<InventoryFolderBase> folders, int version, bool fetchFolders, bool fetchItems)
{
}

View File

@ -627,6 +627,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,
int version,
bool fetchFolders,
bool fetchItems)
{

View File

@ -631,6 +631,7 @@ namespace OpenSim.Tests.Common.Mock
public virtual void SendInventoryFolderDetails(UUID ownerID, UUID folderID,
List<InventoryItemBase> items,
List<InventoryFolderBase> folders,
int version,
bool fetchFolders,
bool fetchItems)
{