aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/WebUtil.cs32
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Hypergrid/HGWorldMapModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs4
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs2
8 files changed, 96 insertions, 20 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs
index 55b38cd..27a646a 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>
@@ -961,8 +965,9 @@ namespace OpenSim.Framework
961 requestStream = request.GetRequestStream(); 965 requestStream = request.GetRequestStream();
962 requestStream.Write(buffer.ToArray(), 0, length); 966 requestStream.Write(buffer.ToArray(), 0, length);
963 } 967 }
964 catch (Exception) 968 catch (Exception e)
965 { 969 {
970 m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
966 return deserial; 971 return deserial;
967 } 972 }
968 finally 973 finally
@@ -976,19 +981,28 @@ namespace OpenSim.Framework
976 { 981 {
977 using (WebResponse resp = request.GetResponse()) 982 using (WebResponse resp = request.GetResponse())
978 { 983 {
979 if (resp.ContentLength > 0) 984 if (resp.ContentLength != 0)
980 { 985 {
981 Stream respStream = resp.GetResponseStream(); 986 Stream respStream = resp.GetResponseStream();
982 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 987 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse));
983 deserial = (TResponse)deserializer.Deserialize(respStream); 988 deserial = (TResponse)deserializer.Deserialize(respStream);
984 respStream.Close(); 989 respStream.Close();
985 } 990 }
991 else
992 m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
993
986 } 994 }
987 } 995 }
988 catch (System.InvalidOperationException) 996 catch (System.InvalidOperationException)
989 { 997 {
990 // This is what happens when there is invalid XML 998 // This is what happens when there is invalid XML
999 m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
991 } 1000 }
1001 catch (Exception e)
1002 {
1003 m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
1004 }
1005
992 return deserial; 1006 return deserial;
993 } 1007 }
994 } 1008 }
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index 1da9d5e..5a2c45c 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -1612,14 +1612,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1612 currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]); 1612 currentPacket.ItemData[itemsSent % MAX_ITEMS_PER_PACKET] = CreateItemDataBlock(items[itemsSent++]);
1613 else 1613 else
1614 { 1614 {
1615// m_log.DebugFormat(
1616// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
1615 OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); 1617 OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
1616 currentPacket = null; 1618 currentPacket = null;
1617 } 1619 }
1618
1619 } 1620 }
1620 1621
1621 if (currentPacket != null) 1622 if (currentPacket != null)
1623 {
1624// m_log.DebugFormat(
1625// "[LLCLIENTVIEW]: Sending inventory folder details packet to {0} for folder {1}", Name, folderID);
1622 OutPacket(currentPacket, ThrottleOutPacketType.Asset, false); 1626 OutPacket(currentPacket, ThrottleOutPacketType.Asset, false);
1627 }
1623 } 1628 }
1624 1629
1625 private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder) 1630 private InventoryDescendentsPacket.FolderDataBlock CreateFolderDataBlock(InventoryFolderBase folder)
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index 919ea33..321b38b 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -178,6 +178,9 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
178 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( 178 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
179 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); 179 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
180 180
181 if (msglist == null)
182 m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list.");
183
181 foreach (GridInstantMessage im in msglist) 184 foreach (GridInstantMessage im in msglist)
182 { 185 {
183 // client.SendInstantMessage(im); 186 // client.SendInstantMessage(im);
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 8073f2d..0cacf2d 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 cd01a05..3bf2c2b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -904,11 +904,29 @@ namespace OpenSim.Region.Framework.Scenes
904 } 904 }
905 } 905 }
906 906
907 /// <summary>
908 /// Link an inventory item to an existing item.
909 /// </summary>
910 /// <remarks>
911 /// The linkee item id is placed in the asset id slot. This appears to be what the viewer expects when
912 /// it receives inventory information.
913 /// </remarks>
914 /// <param name="remoteClient"></param>
915 /// <param name="transActionID"></param>
916 /// <param name="folderID"></param>
917 /// <param name="callbackID"></param>
918 /// <param name="description"></param>
919 /// <param name="name"></param>
920 /// <param name="invType"></param>
921 /// <param name="type">/param>
922 /// <param name="olditemID"></param>
907 private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID, 923 private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID,
908 uint callbackID, string description, string name, 924 uint callbackID, string description, string name,
909 sbyte invType, sbyte type, UUID olditemID) 925 sbyte invType, sbyte type, UUID olditemID)
910 { 926 {
911 m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID); 927 m_log.DebugFormat(
928 "[AGENT INVENTORY]: Received request from {0} to create inventory item link {1} in folder {2} pointing to {3}",
929 remoteClient.Name, name, folderID, olditemID);
912 930
913 if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) 931 if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
914 return; 932 return;
@@ -916,7 +934,20 @@ namespace OpenSim.Region.Framework.Scenes
916 ScenePresence presence; 934 ScenePresence presence;
917 if (TryGetScenePresence(remoteClient.AgentId, out presence)) 935 if (TryGetScenePresence(remoteClient.AgentId, out presence))
918 { 936 {
919// byte[] data = null; 937 bool linkAlreadyExists = false;
938 List<InventoryItemBase> existingItems = InventoryService.GetFolderItems(remoteClient.AgentId, folderID);
939 foreach (InventoryItemBase item in existingItems)
940 if (item.AssetID == olditemID)
941 linkAlreadyExists = true;
942
943 if (linkAlreadyExists)
944 {
945 m_log.WarnFormat(
946 "[AGENT INVENTORY]: Ignoring request from {0} to create item link {1} in folder {2} pointing to {3} since a link already exists",
947 remoteClient.Name, name, folderID, olditemID);
948
949 return;
950 }
920 951
921 AssetBase asset = new AssetBase(); 952 AssetBase asset = new AssetBase();
922 asset.FullID = olditemID; 953 asset.FullID = olditemID;
@@ -1351,11 +1382,28 @@ namespace OpenSim.Region.Framework.Scenes
1351 InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId); 1382 InventoryFolderBase containingFolder = new InventoryFolderBase(folder.ID, client.AgentId);
1352 containingFolder = InventoryService.GetFolder(containingFolder); 1383 containingFolder = InventoryService.GetFolder(containingFolder);
1353 1384
1354 //m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}", 1385// m_log.DebugFormat("[AGENT INVENTORY]: Sending inventory folder contents ({0} nodes) for \"{1}\" to {2} {3}",
1355 // contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName); 1386// contents.Folders.Count + contents.Items.Count, containingFolder.Name, client.FirstName, client.LastName);
1356 1387
1357 if (containingFolder != null && containingFolder != null) 1388 if (containingFolder != null && containingFolder != null)
1389 {
1390 // If the folder requested contains links, then we need to send those folders first, otherwise the links
1391 // will be broken in the viewer.
1392 HashSet<UUID> linkedItemFolderIdsToSend = new HashSet<UUID>();
1393 foreach (InventoryItemBase item in contents.Items)
1394 {
1395 if (item.AssetType == (int)AssetType.Link)
1396 {
1397 InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
1398 linkedItemFolderIdsToSend.Add(linkedItem.Folder);
1399 }
1400 }
1401
1402 foreach (UUID linkedItemFolderId in linkedItemFolderIdsToSend)
1403 SendInventoryUpdate(client, new InventoryFolderBase(linkedItemFolderId), false, true);
1404
1358 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems); 1405 client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, containingFolder.Version, fetchFolders, fetchItems);
1406 }
1359 } 1407 }
1360 1408
1361 /// <summary> 1409 /// <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 379924f..e8ae05b 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -283,6 +283,7 @@ namespace OpenSim.Server.Handlers.Simulation
283 StreamReader reader = new StreamReader(inputStream, encoding); 283 StreamReader reader = new StreamReader(inputStream, encoding);
284 284
285 string requestBody = reader.ReadToEnd(); 285 string requestBody = reader.ReadToEnd();
286 reader.Close();
286 keysvals.Add("body", requestBody); 287 keysvals.Add("body", requestBody);
287 288
288 httpResponse.StatusCode = 200; 289 httpResponse.StatusCode = 200;
@@ -469,6 +470,7 @@ namespace OpenSim.Server.Handlers.Simulation
469 StreamReader reader = new StreamReader(inputStream, encoding); 470 StreamReader reader = new StreamReader(inputStream, encoding);
470 471
471 string requestBody = reader.ReadToEnd(); 472 string requestBody = reader.ReadToEnd();
473 reader.Close();
472 keysvals.Add("body", requestBody); 474 keysvals.Add("body", requestBody);
473 475
474 httpResponse.StatusCode = 200; 476 httpResponse.StatusCode = 200;