aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-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
3 files changed, 51 insertions, 23 deletions
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");