Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2011-05-13 12:05:46 +01:00
commit 75d4956ee5
8 changed files with 94 additions and 21 deletions

View File

@ -199,14 +199,14 @@ namespace OpenSim.Framework
using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress))
{
comp.Write(buffer, 0, buffer.Length);
comp.Flush();
ms.Seek(0, SeekOrigin.Begin);
request.ContentLength = ms.Length; //Count bytes to send
using (Stream requestStream = request.GetRequestStream())
requestStream.Write(ms.ToArray(), 0, (int)ms.Length);
// We need to close the gzip stream before we write it anywhere
// because apparently something important related to gzip compression
// gets written on the strteam upon Dispose()
}
byte[] buf = ms.ToArray();
request.ContentLength = buf.Length; //Count bytes to send
using (Stream requestStream = request.GetRequestStream())
requestStream.Write(buf, 0, (int)buf.Length);
}
}
else
@ -918,6 +918,10 @@ namespace OpenSim.Framework
public class SynchronousRestObjectRequester
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
/// <summary>
/// Perform a synchronous REST request.
/// </summary>
@ -968,8 +972,9 @@ namespace OpenSim.Framework
requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length);
}
catch (Exception)
catch (Exception e)
{
m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
return deserial;
}
finally
@ -983,19 +988,28 @@ namespace OpenSim.Framework
{
using (WebResponse resp = request.GetResponse())
{
if (resp.ContentLength > 0)
if (resp.ContentLength != 0)
{
Stream respStream = resp.GetResponseStream();
XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
deserial = (TResponse)deserializer.Deserialize(respStream);
respStream.Close();
}
else
m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
}
}
catch (System.InvalidOperationException)
{
// This is what happens when there is invalid XML
m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
}
catch (Exception e)
{
m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
}
return deserial;
}
}

View File

@ -1630,15 +1630,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP
currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]);
else
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
currentPacket = null;
}
}
if (currentPacket != null)
{
// m_log.DebugFormat(
// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
}
}
private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder)
{

View File

@ -62,8 +62,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid
{
List<MapBlockData> mapBlocks = new List<MapBlockData>();
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
(minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize,
(minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize);
minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize,
minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
foreach (GridRegion r in regions)
{
@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
FillInMap(mapBlocks, minX, minY, maxX, maxY);
//
remoteClient.SendMapBlock(mapBlocks, flag);
remoteClient.SendMapBlock(mapBlocks, 0);
}
@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid
mblock.X = (ushort)x;
mblock.Y = (ushort)y;
mblock.Name = "";
mblock.Access = 254; // not here???
mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's
mblock.MapImageId = UUID.Zero;
mapBlocks.Add(mblock);
}

View File

@ -820,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
MapBlockData block = new MapBlockData();
block.X = (ushort)minX;
block.Y = (ushort)minY;
block.Access = 254; // == not there
block.Access = 254; // means 'simulator is offline'
response.Add(block);
}
remoteClient.SendMapBlock(response, 0);
@ -846,7 +846,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
MapBlockFromGridRegion(block, r);
mapBlocks.Add(block);
}
remoteClient.SendMapBlock(mapBlocks, flag);
remoteClient.SendMapBlock(mapBlocks, 0);
}
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r)

View File

@ -907,11 +907,29 @@ namespace OpenSim.Region.Framework.Scenes
}
}
/// <summary>
/// Link an inventory item to an existing item.
/// </summary>
/// <remarks>
/// The linkee item id is placed in the asset id slot. This appears to be what the viewer expects when
/// it receives inventory information.
/// </remarks>
/// <param name="remoteClient"></param>
/// <param name="transActionID"></param>
/// <param name="folderID"></param>
/// <param name="callbackID"></param>
/// <param name="description"></param>
/// <param name="name"></param>
/// <param name="invType"></param>
/// <param name="type">/param>
/// <param name="olditemID"></param>
private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID,
uint callbackID, string description, string name,
sbyte invType, sbyte type, UUID olditemID)
{
m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID);
m_log.DebugFormat(
"[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
remoteClient.Name, name, folderID, olditemID);
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return;
@ -919,7 +937,20 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence presence;
if (TryGetScenePresence(remoteClient.AgentId, out presence))
{
// byte[] data = null;
bool linkAlreadyExists = false;
List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID);
foreach (InventoryItemBase item in existingItems)
if (item.AssetID == olditemID)
linkAlreadyExists = true;
if (linkAlreadyExists)
{
m_log.WarnFormat(
"[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists",
remoteClient.Name, name, folderID, olditemID);
return;
}
AssetBase asset = new AssetBase();
asset.FullID = olditemID;
@ -1370,12 +1401,29 @@ namespace OpenSim.Region.Framework.Scenes
InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId);
containingFolder = InventoryService.GetFolder(containingFolder);
//m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
if (containingFolder != null && containingFolder != null)
{
// If the folder requested contains links, then we need to send those folders first, otherwise the links
// will be broken in the viewer.
HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
foreach (InventoryItemBase item in contents.Items)
{
if (item.AssetType == (int)AssetType.Link)
{
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
}
}
foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems);
}
}
/// <summary>
/// Update an item in a prim (task) inventory.

View File

@ -499,6 +499,10 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder)
{
// m_log.DebugFormat(
// "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}",
// remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder);
if (folderID == UUID.Zero)
return;

View File

@ -306,6 +306,7 @@ namespace OpenSim.Server.Handlers.Simulation
StreamReader reader = new StreamReader(inputStream, encoding);
string requestBody = reader.ReadToEnd();
reader.Close();
keysvals.Add("body", requestBody);
httpResponse.StatusCode = 200;
@ -492,6 +493,7 @@ namespace OpenSim.Server.Handlers.Simulation
StreamReader reader = new StreamReader(inputStream, encoding);
string requestBody = reader.ReadToEnd();
reader.Close();
keysvals.Add("body", requestBody);
httpResponse.StatusCode = 200;

View File

@ -14,7 +14,7 @@
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{HH:mm:ss} - %message" />
<!-- console log with milliseconds. Useful for debugging -->
<!-- <conversionPattern value="%date{HH:mm:ss.fff} - %message" /> -->
<!-- <conversionPattern value="%date{HH:mm:ss.fff} - %message" /> -->
</layout>
</appender>