diff options
author | Melanie | 2011-05-13 12:05:46 +0100 |
---|---|---|
committer | Melanie | 2011-05-13 12:05:46 +0100 |
commit | 75d4956ee58340adca06d2ad602e2cd87b2e5943 (patch) | |
tree | 8203a626b75a7926bcffe8044847724fd53dae40 /OpenSim | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.zip opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.gz opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.bz2 opensim-SC-75d4956ee58340adca06d2ad602e2cd87b2e5943.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim')
7 files changed, 93 insertions, 20 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 4b69468..5211157 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -199,14 +199,14 @@ namespace OpenSim.Framework | |||
199 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) | 199 | using (GZipStream comp = new GZipStream(ms, CompressionMode.Compress)) |
200 | { | 200 | { |
201 | comp.Write(buffer, 0, buffer.Length); | 201 | comp.Write(buffer, 0, buffer.Length); |
202 | comp.Flush(); | 202 | // We need to close the gzip stream before we write it anywhere |
203 | 203 | // because apparently something important related to gzip compression | |
204 | ms.Seek(0, SeekOrigin.Begin); | 204 | // gets written on the strteam upon Dispose() |
205 | |||
206 | request.ContentLength = ms.Length; //Count bytes to send | ||
207 | using (Stream requestStream = request.GetRequestStream()) | ||
208 | requestStream.Write(ms.ToArray(), 0, (int)ms.Length); | ||
209 | } | 205 | } |
206 | byte[] buf = ms.ToArray(); | ||
207 | request.ContentLength = buf.Length; //Count bytes to send | ||
208 | using (Stream requestStream = request.GetRequestStream()) | ||
209 | requestStream.Write(buf, 0, (int)buf.Length); | ||
210 | } | 210 | } |
211 | } | 211 | } |
212 | else | 212 | else |
@@ -918,6 +918,10 @@ namespace OpenSim.Framework | |||
918 | 918 | ||
919 | public class SynchronousRestObjectRequester | 919 | public class SynchronousRestObjectRequester |
920 | { | 920 | { |
921 | private static readonly ILog m_log = | ||
922 | LogManager.GetLogger( | ||
923 | MethodBase.GetCurrentMethod().DeclaringType); | ||
924 | |||
921 | /// <summary> | 925 | /// <summary> |
922 | /// Perform a synchronous REST request. | 926 | /// Perform a synchronous REST request. |
923 | /// </summary> | 927 | /// </summary> |
@@ -968,8 +972,9 @@ namespace OpenSim.Framework | |||
968 | requestStream = request.GetRequestStream(); | 972 | requestStream = request.GetRequestStream(); |
969 | requestStream.Write(buffer.ToArray(), 0, length); | 973 | requestStream.Write(buffer.ToArray(), 0, length); |
970 | } | 974 | } |
971 | catch (Exception) | 975 | catch (Exception e) |
972 | { | 976 | { |
977 | m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e); | ||
973 | return deserial; | 978 | return deserial; |
974 | } | 979 | } |
975 | finally | 980 | finally |
@@ -983,19 +988,28 @@ namespace OpenSim.Framework | |||
983 | { | 988 | { |
984 | using (WebResponse resp = request.GetResponse()) | 989 | using (WebResponse resp = request.GetResponse()) |
985 | { | 990 | { |
986 | if (resp.ContentLength > 0) | 991 | if (resp.ContentLength != 0) |
987 | { | 992 | { |
988 | Stream respStream = resp.GetResponseStream(); | 993 | Stream respStream = resp.GetResponseStream(); |
989 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 994 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
990 | deserial = (TResponse)deserializer.Deserialize(respStream); | 995 | deserial = (TResponse)deserializer.Deserialize(respStream); |
991 | respStream.Close(); | 996 | respStream.Close(); |
992 | } | 997 | } |
998 | else | ||
999 | m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); | ||
1000 | |||
993 | } | 1001 | } |
994 | } | 1002 | } |
995 | catch (System.InvalidOperationException) | 1003 | catch (System.InvalidOperationException) |
996 | { | 1004 | { |
997 | // This is what happens when there is invalid XML | 1005 | // This is what happens when there is invalid XML |
1006 | m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString()); | ||
998 | } | 1007 | } |
1008 | catch (Exception e) | ||
1009 | { | ||
1010 | m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e); | ||
1011 | } | ||
1012 | |||
999 | return deserial; | 1013 | return deserial; |
1000 | } | 1014 | } |
1001 | } | 1015 | } |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index de40abd..7564907 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -1630,14 +1630,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1630 | currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); | 1630 | currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); |
1631 | else | 1631 | else |
1632 | { | 1632 | { |
1633 | // m_log.DebugFormat( | ||
1634 | // "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID); | ||
1633 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); | 1635 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); |
1634 | currentPacket = null; | 1636 | currentPacket = null; |
1635 | } | 1637 | } |
1636 | |||
1637 | } | 1638 | } |
1638 | 1639 | ||
1639 | if (currentPacket != null) | 1640 | if (currentPacket != null) |
1641 | { | ||
1642 | // m_log.DebugFormat( | ||
1643 | // "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID); | ||
1640 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); | 1644 | OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); |
1645 | } | ||
1641 | } | 1646 | } |
1642 | 1647 | ||
1643 | private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) | 1648 | private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) |
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs index a0ccdc7..5ab334f 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs | |||
@@ -62,8 +62,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
62 | { | 62 | { |
63 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); | 63 | List<MapBlockData> mapBlocks = new List<MapBlockData>(); |
64 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, | 64 | List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, |
65 | (minX - 4) * (int)Constants.RegionSize, (maxX + 4) * (int)Constants.RegionSize, | 65 | minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, |
66 | (minY - 4) * (int)Constants.RegionSize, (maxY + 4) * (int)Constants.RegionSize); | 66 | minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); |
67 | 67 | ||
68 | foreach (GridRegion r in regions) | 68 | foreach (GridRegion r in regions) |
69 | { | 69 | { |
@@ -76,7 +76,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
76 | FillInMap(mapBlocks, minX, minY, maxX, maxY); | 76 | FillInMap(mapBlocks, minX, minY, maxX, maxY); |
77 | // | 77 | // |
78 | 78 | ||
79 | remoteClient.SendMapBlock(mapBlocks, flag); | 79 | remoteClient.SendMapBlock(mapBlocks, 0); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
93 | mblock.X = (ushort)x; | 93 | mblock.X = (ushort)x; |
94 | mblock.Y = (ushort)y; | 94 | mblock.Y = (ushort)y; |
95 | mblock.Name = ""; | 95 | mblock.Name = ""; |
96 | mblock.Access = 254; // not here??? | 96 | mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's |
97 | mblock.MapImageId = UUID.Zero; | 97 | mblock.MapImageId = UUID.Zero; |
98 | mapBlocks.Add(mblock); | 98 | mapBlocks.Add(mblock); |
99 | } | 99 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index fe919b7..cd40c5d 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -820,7 +820,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
820 | MapBlockData block = new MapBlockData(); | 820 | MapBlockData block = new MapBlockData(); |
821 | block.X = (ushort)minX; | 821 | block.X = (ushort)minX; |
822 | block.Y = (ushort)minY; | 822 | block.Y = (ushort)minY; |
823 | block.Access = 254; // == not there | 823 | block.Access = 254; // means 'simulator is offline' |
824 | response.Add(block); | 824 | response.Add(block); |
825 | } | 825 | } |
826 | remoteClient.SendMapBlock(response, 0); | 826 | remoteClient.SendMapBlock(response, 0); |
@@ -846,7 +846,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
846 | MapBlockFromGridRegion(block, r); | 846 | MapBlockFromGridRegion(block, r); |
847 | mapBlocks.Add(block); | 847 | mapBlocks.Add(block); |
848 | } | 848 | } |
849 | remoteClient.SendMapBlock(mapBlocks, flag); | 849 | remoteClient.SendMapBlock(mapBlocks, 0); |
850 | } | 850 | } |
851 | 851 | ||
852 | protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) | 852 | protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dfb5846..1c30a35 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -907,11 +907,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
907 | } | 907 | } |
908 | } | 908 | } |
909 | 909 | ||
910 | /// <summary> | ||
911 | /// Link an inventory item to an existing item. | ||
912 | /// </summary> | ||
913 | /// <remarks> | ||
914 | /// The linkee item id is placed in the asset id slot. This appears to be what the viewer expects when | ||
915 | /// it receives inventory information. | ||
916 | /// </remarks> | ||
917 | /// <param name="remoteClient"></param> | ||
918 | /// <param name="transActionID"></param> | ||
919 | /// <param name="folderID"></param> | ||
920 | /// <param name="callbackID"></param> | ||
921 | /// <param name="description"></param> | ||
922 | /// <param name="name"></param> | ||
923 | /// <param name="invType"></param> | ||
924 | /// <param name="type">/param> | ||
925 | /// <param name="olditemID"></param> | ||
910 | private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, | 926 | private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, |
911 | uint callbackID, string description, string name, | 927 | uint callbackID, string description, string name, |
912 | sbyte invType, sbyte type, UUID olditemID) | 928 | sbyte invType, sbyte type, UUID olditemID) |
913 | { | 929 | { |
914 | m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID); | 930 | m_log.DebugFormat( |
931 | "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}", | ||
932 | remoteClient.Name, name, folderID, olditemID); | ||
915 | 933 | ||
916 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) | 934 | if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) |
917 | return; | 935 | return; |
@@ -919,7 +937,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
919 | ScenePresence presence; | 937 | ScenePresence presence; |
920 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) | 938 | if (TryGetScenePresence(remoteClient.AgentId, out presence)) |
921 | { | 939 | { |
922 | // byte[] data = null; | 940 | bool linkAlreadyExists = false; |
941 | List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID); | ||
942 | foreach (InventoryItemBase item in existingItems) | ||
943 | if (item.AssetID == olditemID) | ||
944 | linkAlreadyExists = true; | ||
945 | |||
946 | if (linkAlreadyExists) | ||
947 | { | ||
948 | m_log.WarnFormat( | ||
949 | "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists", | ||
950 | remoteClient.Name, name, folderID, olditemID); | ||
951 | |||
952 | return; | ||
953 | } | ||
923 | 954 | ||
924 | AssetBase asset = new AssetBase(); | 955 | AssetBase asset = new AssetBase(); |
925 | asset.FullID = olditemID; | 956 | asset.FullID = olditemID; |
@@ -1370,11 +1401,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1370 | InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); | 1401 | InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); |
1371 | containingFolder = InventoryService.GetFolder(containingFolder); | 1402 | containingFolder = InventoryService.GetFolder(containingFolder); |
1372 | 1403 | ||
1373 | //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", | 1404 | // m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", |
1374 | // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); | 1405 | // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); |
1375 | 1406 | ||
1376 | if (containingFolder != null && containingFolder != null) | 1407 | if (containingFolder != null && containingFolder != null) |
1408 | { | ||
1409 | // If the folder requested contains links, then we need to send those folders first, otherwise the links | ||
1410 | // will be broken in the viewer. | ||
1411 | HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>(); | ||
1412 | foreach (InventoryItemBase item in contents.Items) | ||
1413 | { | ||
1414 | if (item.AssetType == (int)AssetType.Link) | ||
1415 | { | ||
1416 | InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); | ||
1417 | linkedItemFolderIdsToSend.Add(linkedItem.Folder); | ||
1418 | } | ||
1419 | } | ||
1420 | |||
1421 | foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend) | ||
1422 | SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true); | ||
1423 | |||
1377 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); | 1424 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); |
1425 | } | ||
1378 | } | 1426 | } |
1379 | 1427 | ||
1380 | /// <summary> | 1428 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ab567fb..e2d7208 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -499,6 +499,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
499 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, | 499 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, |
500 | bool fetchFolders, bool fetchItems, int sortOrder) | 500 | bool fetchFolders, bool fetchItems, int sortOrder) |
501 | { | 501 | { |
502 | // m_log.DebugFormat( | ||
503 | // "[USER INVENTORY]: HandleFetchInventoryDescendents() for {0}, folder={1}, fetchFolders={2}, fetchItems={3}, sortOrder={4}", | ||
504 | // remoteClient.Name, folderID, fetchFolders, fetchItems, sortOrder); | ||
505 | |||
502 | if (folderID == UUID.Zero) | 506 | if (folderID == UUID.Zero) |
503 | return; | 507 | return; |
504 | 508 | ||
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 9f581ca..9935e3c 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -306,6 +306,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
306 | StreamReader reader = new StreamReader(inputStream, encoding); | 306 | StreamReader reader = new StreamReader(inputStream, encoding); |
307 | 307 | ||
308 | string requestBody = reader.ReadToEnd(); | 308 | string requestBody = reader.ReadToEnd(); |
309 | reader.Close(); | ||
309 | keysvals.Add("body", requestBody); | 310 | keysvals.Add("body", requestBody); |
310 | 311 | ||
311 | httpResponse.StatusCode = 200; | 312 | httpResponse.StatusCode = 200; |
@@ -492,6 +493,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
492 | StreamReader reader = new StreamReader(inputStream, encoding); | 493 | StreamReader reader = new StreamReader(inputStream, encoding); |
493 | 494 | ||
494 | string requestBody = reader.ReadToEnd(); | 495 | string requestBody = reader.ReadToEnd(); |
496 | reader.Close(); | ||
495 | keysvals.Add("body", requestBody); | 497 | keysvals.Add("body", requestBody); |
496 | 498 | ||
497 | httpResponse.StatusCode = 200; | 499 | httpResponse.StatusCode = 200; |