aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorRobert Adams2013-10-16 07:53:44 -0700
committerRobert Adams2013-10-16 07:53:44 -0700
commit8937a2244d65ea71c402777bb68a986f60982e07 (patch)
tree03601074b85b0c41ff15f5155a4b14c197954450 /OpenSim/Region/CoreModules
parentvarregion: move the compressed heighmap compression factor from (diff)
parentBulletSim: implement the SL bug where VEHICLE_HOVER_UP_ONLY disables (diff)
downloadopensim-SC_OLD-8937a2244d65ea71c402777bb68a986f60982e07.zip
opensim-SC_OLD-8937a2244d65ea71c402777bb68a986f60982e07.tar.gz
opensim-SC_OLD-8937a2244d65ea71c402777bb68a986f60982e07.tar.bz2
opensim-SC_OLD-8937a2244d65ea71c402777bb68a986f60982e07.tar.xz
Merge branch 'master' into varregion
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs12
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs51
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs47
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs21
6 files changed, 78 insertions, 68 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 0271738..f56d17d 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -33,6 +33,7 @@ using OpenSim.Framework;
33 33
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
36using OpenSim.Region.Framework.Interfaces;
36 37
37namespace OpenSim.Region.CoreModules.Agent.AssetTransaction 38namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
38{ 39{
@@ -119,6 +120,14 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
119 } 120 }
120 else 121 else
121 { 122 {
123 // Check if the xfer is a terrain xfer
124 IEstateModule estateModule = m_Scene.RequestModuleInterface<IEstateModule>();
125 if (estateModule != null)
126 {
127 if (estateModule.IsTerrainXfer(xferID))
128 return;
129 }
130
122 m_log.ErrorFormat( 131 m_log.ErrorFormat(
123 "[AGENT ASSET TRANSACTIONS]: Could not find uploader for xfer id {0}, packet id {1}, data length {2}", 132 "[AGENT ASSET TRANSACTIONS]: Could not find uploader for xfer id {0}, packet id {1}, data length {2}",
124 xferID, packetID, data.Length); 133 xferID, packetID, data.Length);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
index 2116605..ff87ece 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsRequestHandler.cs
@@ -42,14 +42,22 @@ using log4net;
42 42
43namespace OpenSim.Region.CoreModules.Avatar.Friends 43namespace OpenSim.Region.CoreModules.Avatar.Friends
44{ 44{
45 public class FriendsRequestHandler : BaseStreamHandler 45 public class FriendsRequestHandler : BaseStreamHandlerBasicDOSProtector
46 { 46 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private FriendsModule m_FriendsModule; 49 private FriendsModule m_FriendsModule;
50 50
51 public FriendsRequestHandler(FriendsModule fmodule) 51 public FriendsRequestHandler(FriendsModule fmodule)
52 : base("POST", "/friends") 52 : base("POST", "/friends", new BasicDosProtectorOptions()
53 {
54 AllowXForwardedFor = true,
55 ForgetTimeSpan = TimeSpan.FromMinutes(2),
56 MaxRequestsInTimeframe = 20,
57 ReportingName = "FRIENDSDOSPROTECTOR",
58 RequestTimeSpan = TimeSpan.FromSeconds(5),
59 ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
60 })
53 { 61 {
54 m_FriendsModule = fmodule; 62 m_FriendsModule = fmodule;
55 } 63 }
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 0ec9575..831922e 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -757,64 +757,29 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
757 757
758 SceneObjectGroup group = null; 758 SceneObjectGroup group = null;
759 759
760 string xmlData = Utils.BytesToString(rezAsset.Data); 760 List<SceneObjectGroup> objlist;
761 List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(); 761 List<Vector3> veclist;
762 List<Vector3> veclist = new List<Vector3>(); 762 Vector3 bbox;
763 float offsetHeight;
763 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); 764 byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
764 Vector3 pos; 765 Vector3 pos;
765 766
766 XmlDocument doc = new XmlDocument(); 767 bool single = m_Scene.GetObjectsToRez(rezAsset.Data, attachment, out objlist, out veclist, out bbox, out offsetHeight);
767 doc.LoadXml(xmlData);
768 XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
769 if (e == null || attachment) // Single
770 {
771 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
772
773 objlist.Add(g);
774 veclist.Add(Vector3.Zero);
775 768
776 float offsetHeight = 0; 769 if (single)
770 {
777 pos = m_Scene.GetNewRezLocation( 771 pos = m_Scene.GetNewRezLocation(
778 RayStart, RayEnd, RayTargetID, Quaternion.Identity, 772 RayStart, RayEnd, RayTargetID, Quaternion.Identity,
779 BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); 773 BypassRayCast, bRayEndIsIntersection, true, bbox, false);
780 pos.Z += offsetHeight; 774 pos.Z += offsetHeight;
781 } 775 }
782 else 776 else
783 { 777 {
784 XmlElement coll = (XmlElement)e;
785 float bx = Convert.ToSingle(coll.GetAttribute("x"));
786 float by = Convert.ToSingle(coll.GetAttribute("y"));
787 float bz = Convert.ToSingle(coll.GetAttribute("z"));
788 Vector3 bbox = new Vector3(bx, by, bz);
789
790 pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, 778 pos = m_Scene.GetNewRezLocation(RayStart, RayEnd,
791 RayTargetID, Quaternion.Identity, 779 RayTargetID, Quaternion.Identity,
792 BypassRayCast, bRayEndIsIntersection, true, 780 BypassRayCast, bRayEndIsIntersection, true,
793 bbox, false); 781 bbox, false);
794
795 pos -= bbox / 2; 782 pos -= bbox / 2;
796
797 XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
798 foreach (XmlNode n in groups)
799 {
800 SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml);
801
802 objlist.Add(g);
803 XmlElement el = (XmlElement)n;
804
805 string rawX = el.GetAttribute("offsetx");
806 string rawY = el.GetAttribute("offsety");
807 string rawZ = el.GetAttribute("offsetz");
808//
809// m_log.DebugFormat(
810// "[INVENTORY ACCESS MODULE]: Converting coalesced object {0} offset <{1}, {2}, {3}>",
811// g.Name, rawX, rawY, rawZ);
812
813 float x = Convert.ToSingle(rawX);
814 float y = Convert.ToSingle(rawY);
815 float z = Convert.ToSingle(rawZ);
816 veclist.Add(new Vector3(x, y, z));
817 }
818 } 783 }
819 784
820 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment)) 785 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment))
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 42db1cf..17387da 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -829,26 +829,23 @@ namespace OpenSim.Region.CoreModules.World.Estate
829 829
830 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID) 830 private void AbortTerrainXferHandler(IClientAPI remoteClient, ulong XferID)
831 { 831 {
832 if (TerrainUploader != null) 832 lock (this)
833 { 833 {
834 lock (TerrainUploader) 834 if ((TerrainUploader != null) && (XferID == TerrainUploader.XferID))
835 { 835 {
836 if (XferID == TerrainUploader.XferID) 836 remoteClient.OnXferReceive -= TerrainUploader.XferReceive;
837 { 837 remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
838 remoteClient.OnXferReceive -= TerrainUploader.XferReceive; 838 TerrainUploader.TerrainUploadDone -= HandleTerrainApplication;
839 remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
840 TerrainUploader.TerrainUploadDone -= HandleTerrainApplication;
841 839
842 TerrainUploader = null; 840 TerrainUploader = null;
843 remoteClient.SendAlertMessage("Terrain Upload aborted by the client"); 841 remoteClient.SendAlertMessage("Terrain Upload aborted by the client");
844 }
845 } 842 }
846 } 843 }
847
848 } 844 }
845
849 private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient) 846 private void HandleTerrainApplication(string filename, byte[] terrainData, IClientAPI remoteClient)
850 { 847 {
851 lock (TerrainUploader) 848 lock (this)
852 { 849 {
853 remoteClient.OnXferReceive -= TerrainUploader.XferReceive; 850 remoteClient.OnXferReceive -= TerrainUploader.XferReceive;
854 remoteClient.OnAbortXfer -= AbortTerrainXferHandler; 851 remoteClient.OnAbortXfer -= AbortTerrainXferHandler;
@@ -907,22 +904,32 @@ namespace OpenSim.Region.CoreModules.World.Estate
907 904
908 private void handleUploadTerrain(IClientAPI remote_client, string clientFileName) 905 private void handleUploadTerrain(IClientAPI remote_client, string clientFileName)
909 { 906 {
910 if (TerrainUploader == null) 907 lock (this)
911 { 908 {
912 909 if (TerrainUploader == null)
913 TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
914 lock (TerrainUploader)
915 { 910 {
911 m_log.DebugFormat("Starting to receive uploaded terrain");
912 TerrainUploader = new EstateTerrainXferHandler(remote_client, clientFileName);
916 remote_client.OnXferReceive += TerrainUploader.XferReceive; 913 remote_client.OnXferReceive += TerrainUploader.XferReceive;
917 remote_client.OnAbortXfer += AbortTerrainXferHandler; 914 remote_client.OnAbortXfer += AbortTerrainXferHandler;
918 TerrainUploader.TerrainUploadDone += HandleTerrainApplication; 915 TerrainUploader.TerrainUploadDone += HandleTerrainApplication;
916 TerrainUploader.RequestStartXfer(remote_client);
917 }
918 else
919 {
920 remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!");
919 } 921 }
920 TerrainUploader.RequestStartXfer(remote_client);
921
922 } 922 }
923 else 923 }
924
925 public bool IsTerrainXfer(ulong xferID)
926 {
927 lock (this)
924 { 928 {
925 remote_client.SendAlertMessage("Another Terrain Upload is in progress. Please wait your turn!"); 929 if (TerrainUploader == null)
930 return false;
931 else
932 return TerrainUploader.XferID == xferID;
926 } 933 }
927 } 934 }
928 935
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
index b8d8b10..2d74eaf 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateTerrainXferHandler.cs
@@ -78,7 +78,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
78 /// <param name="data"></param> 78 /// <param name="data"></param>
79 public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) 79 public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
80 { 80 {
81 if (mXferID == xferID) 81 if (mXferID != xferID)
82 return;
83
84 lock (this)
82 { 85 {
83 if (m_asset.Data.Length > 1) 86 if (m_asset.Data.Length > 1)
84 { 87 {
@@ -99,7 +102,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
99 if ((packetID & 0x80000000) != 0) 102 if ((packetID & 0x80000000) != 0)
100 { 103 {
101 SendCompleteMessage(remoteClient); 104 SendCompleteMessage(remoteClient);
102
103 } 105 }
104 } 106 }
105 } 107 }
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index c985ca2..8383f4e 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -165,7 +165,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
165 regionimage = regionimage.Replace("-", ""); 165 regionimage = regionimage.Replace("-", "");
166 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage); 166 m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
167 167
168 MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage); 168 MainServer.Instance.AddHTTPHandler(regionimage,
169 new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
170 {
171 AllowXForwardedFor = false,
172 ForgetTimeSpan = TimeSpan.FromMinutes(2),
173 MaxRequestsInTimeframe = 4,
174 ReportingName = "MAPDOSPROTECTOR",
175 RequestTimeSpan = TimeSpan.FromSeconds(10),
176 ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
177 }).Process);
169 MainServer.Instance.AddLLSDHandler( 178 MainServer.Instance.AddLLSDHandler(
170 "/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest); 179 "/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
171 180
@@ -1081,6 +1090,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
1081 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); 1090 block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
1082 } 1091 }
1083 1092
1093 public Hashtable OnHTTPThrottled(Hashtable keysvals)
1094 {
1095 Hashtable reply = new Hashtable();
1096 int statuscode = 500;
1097 reply["str_response_string"] = "";
1098 reply["int_response_code"] = statuscode;
1099 reply["content_type"] = "text/plain";
1100 return reply;
1101 }
1102
1084 public Hashtable OnHTTPGetMapImage(Hashtable keysvals) 1103 public Hashtable OnHTTPGetMapImage(Hashtable keysvals)
1085 { 1104 {
1086 m_log.Debug("[WORLD MAP]: Sending map image jpeg"); 1105 m_log.Debug("[WORLD MAP]: Sending map image jpeg");