suspend httpdos on mapimge, fix image not been updated after first Get till restart

LSLKeyTest
UbitUmarov 2016-09-05 12:30:25 +01:00
parent 0e68742afc
commit 49c579ec71
2 changed files with 24 additions and 12 deletions

View File

@ -210,7 +210,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
return; return;
} }
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
// mapTile.Save( // DEBUG DEBUG // mapTile.Save( // DEBUG DEBUG
// String.Format("maptiles/raw-{0}-{1}-{2}.jpg", regionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY), // String.Format("maptiles/raw-{0}-{1}-{2}.jpg", regionName, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY),
@ -218,12 +217,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
// If the region/maptile is legacy sized, just upload the one tile like it has always been done // If the region/maptile is legacy sized, just upload the one tile like it has always been done
if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
{ {
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
ConvertAndUploadMaptile(scene, mapTile, ConvertAndUploadMaptile(scene, mapTile,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
scene.RegionInfo.RegionName); scene.RegionInfo.RegionName);
} }
else else
{ {
m_log.DebugFormat("{0} Upload {1} maptiles for {2}", LogHeader,
(mapTile.Width * mapTile.Height) / (Constants.RegionSize * Constants.RegionSize),
scene.Name);
// For larger regions (varregion) we must cut the region image into legacy sized // For larger regions (varregion) we must cut the region image into legacy sized
// pieces since that is how the maptile system works. // pieces since that is how the maptile system works.
// Note the assumption that varregions are always a multiple of legacy size. // Note the assumption that varregions are always a multiple of legacy size.

View File

@ -66,7 +66,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg"; private static readonly string DEFAULT_WORLD_MAP_EXPORT_PATH = "exportmap.jpg";
private static readonly UUID STOP_UUID = UUID.Random(); private static readonly UUID STOP_UUID = UUID.Random();
private static readonly string m_mapLayerPath = "0001/";
private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>(); private OpenSim.Framework.BlockingQueue<MapRequestState> requests = new OpenSim.Framework.BlockingQueue<MapRequestState>();
@ -177,6 +176,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
regionimage = regionimage.Replace("-", ""); regionimage = regionimage.Replace("-", "");
m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage); m_log.Info("[WORLD MAP]: JPEG Map location: " + m_scene.RegionInfo.ServerURI + "index.php?method=" + regionimage);
/*
MainServer.Instance.AddHTTPHandler(regionimage, MainServer.Instance.AddHTTPHandler(regionimage,
new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions() new GenericHTTPDOSProtector(OnHTTPGetMapImage, OnHTTPThrottled, new BasicDosProtectorOptions()
{ {
@ -187,6 +187,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
RequestTimeSpan = TimeSpan.FromSeconds(10), RequestTimeSpan = TimeSpan.FromSeconds(10),
ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod ThrottledAction = BasicDOSProtector.ThrottleAction.DoThrottledMethod
}).Process); }).Process);
*/
MainServer.Instance.AddHTTPHandler(regionimage, OnHTTPGetMapImage);
MainServer.Instance.AddLLSDHandler( MainServer.Instance.AddLLSDHandler(
"/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest); "/MAP/MapItems/" + m_scene.RegionInfo.RegionHandle.ToString(), HandleRemoteMapItemRequest);
@ -222,12 +225,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
public void OnRegisterCaps(UUID agentID, Caps caps) public void OnRegisterCaps(UUID agentID, Caps caps)
{ {
//m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); //m_log.DebugFormat("[WORLD MAP]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
string capsBase = "/CAPS/" + caps.CapsObjectPath; string capspath = "/CAPS/" + UUID.Random();
caps.RegisterHandler( caps.RegisterHandler(
"MapLayer", "MapLayer",
new RestStreamHandler( new RestStreamHandler(
"POST", "POST",
capsBase + m_mapLayerPath, capspath,
(request, path, param, httpRequest, httpResponse) (request, path, param, httpRequest, httpResponse)
=> MapLayerRequest(request, path, param, agentID, caps), => MapLayerRequest(request, path, param, agentID, caps),
"MapLayer", "MapLayer",
@ -1142,10 +1145,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
protected void MapBlockSendThread() protected void MapBlockSendThread()
{ {
List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>();
while (true) while (true)
{ {
List<MapBlockRequestData> thisRunData = new List<MapBlockRequestData>();
m_mapBlockRequestEvent.WaitOne(); m_mapBlockRequestEvent.WaitOne();
lock (m_mapBlockRequestEvent) lock (m_mapBlockRequestEvent)
{ {
@ -1162,13 +1164,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_mapBlockRequestEvent.Reset(); m_mapBlockRequestEvent.Reset();
} }
foreach (MapBlockRequestData req in thisRunData) if(thisRunData.Count > 0)
{ {
// Null client stops thread foreach (MapBlockRequestData req in thisRunData)
if (req.client == null) {
return; // Null client stops thread
if (req.client == null)
return;
GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags); GetAndSendBlocksInternal(req.client, req.minX, req.minY, req.maxX, req.maxY, req.flags);
}
thisRunData.Clear();
} }
Thread.Sleep(50); Thread.Sleep(50);
@ -1590,6 +1597,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
m_scene.AssetService.Delete(lastID.ToString()); m_scene.AssetService.Delete(lastID.ToString());
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Zero; m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Zero;
myMapImageJPEG = new byte[0];
needRegionSave = true; needRegionSave = true;
} }
@ -1648,7 +1656,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
asset.Flags = AssetFlags.Maptile; asset.Flags = AssetFlags.Maptile;
// Store the new one // Store the new one
m_log.DebugFormat("[WORLD MAP]: Storing map tile {0} for {1}", asset.ID, m_scene.RegionInfo.RegionName); m_log.DebugFormat("[WORLD MAP]: Storing map image {0} for {1}", asset.ID, m_scene.RegionInfo.RegionName);
m_scene.AssetService.Store(asset); m_scene.AssetService.Store(asset);