Merge branch 'master' into httptests

This commit is contained in:
UbitUmarov
2016-09-17 12:44:52 +01:00
21 changed files with 701 additions and 426 deletions

View File

@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
}
catch (Exception e)
{
m_log.Error("[EMAIL] DefaultEmailModule not configured: " + e.Message);
m_log.Error("[EMAIL]: DefaultEmailModule not configured: " + e.Message);
m_Enabled = false;
return;
}
@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
}
}
m_log.Info("[EMAIL] Activated DefaultEmailModule");
m_log.Info("[EMAIL]: Activated DefaultEmailModule");
}
public void RemoveRegion(Scene scene)
@@ -268,12 +268,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
bool isEMailStrictMatch = EMailreStrict.IsMatch(address);
if (!isEMailStrictMatch)
{
m_log.Error("[EMAIL] REGEX Problem in EMail Address: "+address);
m_log.Error("[EMAIL]: REGEX Problem in EMail Address: "+address);
return;
}
if ((subject.Length + body.Length) > m_MaxEmailSize)
{
m_log.Error("[EMAIL] subject + body larger than limit of " + m_MaxEmailSize + " bytes");
m_log.Error("[EMAIL]: subject + body larger than limit of " + m_MaxEmailSize + " bytes");
return;
}
@@ -318,11 +318,11 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
emailMessage.Send(smtpServer);
//Log
m_log.Info("[EMAIL] EMail sent to: " + address + " from object: " + objectID.ToString() + "@" + m_HostName);
m_log.Info("[EMAIL]: EMail sent to: " + address + " from object: " + objectID.ToString() + "@" + m_HostName);
}
catch (Exception e)
{
m_log.Error("[EMAIL] DefaultEmailModule Exception: " + e.Message);
m_log.Error("[EMAIL]: DefaultEmailModule Exception: " + e.Message);
}
}
else

View File

@@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
private IGridService m_GridService;
private RegionInfoCache m_RegionInfoCache;
private HashSet<Scene> m_scenes = new HashSet<Scene>();
private bool m_Enabled;
@@ -68,7 +69,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public LocalGridServicesConnector(IConfigSource source, RegionInfoCache regionInfoCache)
{
m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly witj cache.", LogHeader);
m_log.DebugFormat("{0} LocalGridServicesConnector instantiated directly with cache.", LogHeader);
InitialiseService(source, regionInfoCache);
}
@@ -137,11 +138,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public void PostInitialise()
{
// FIXME: We will still add this command even if we aren't enabled since RemoteGridServiceConnector
// will have instantiated us directly.
MainConsole.Instance.Commands.AddCommand("Regions", false, "show neighbours",
"show neighbours",
"Shows the local regions' neighbours", HandleShowNeighboursCommand);
}
public void Close()
@@ -153,6 +149,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (!m_Enabled)
return;
lock(m_scenes)
{
if(!m_scenes.Contains(scene))
m_scenes.Add(scene);
}
scene.RegisterModuleInterface<IGridService>(this);
GridRegion r = new GridRegion(scene.RegionInfo);
@@ -166,6 +167,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
if (!m_Enabled)
return;
lock(m_scenes)
{
if(m_scenes.Contains(scene))
m_scenes.Remove(scene);
}
m_RegionInfoCache.Remove(scene.RegionInfo.ScopeID, scene.RegionInfo.RegionHandle);
scene.EventManager.OnRegionUp -= OnRegionUp;
}
@@ -221,14 +228,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{
// try in cache by handler first
// ulong regionHandle = Util.RegionWorldLocToHandle((uint)x, (uint)y);
bool inCache = false;
// GridRegion rinfo = m_RegionInfoCache.Get(scopeID, regionHandle, out inCache);
// if (inCache)
// return rinfo;
GridRegion rinfo = m_RegionInfoCache.Get(scopeID, (uint)x, (uint)y, out inCache);
if (inCache)
return rinfo;
@@ -295,24 +295,5 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
#endregion
public void HandleShowNeighboursCommand(string module, string[] cmdparams)
{
System.Text.StringBuilder caps = new System.Text.StringBuilder();
/* temporary broken
lock (m_LocalCache)
{
foreach (KeyValuePair<UUID, RegionCache> kvp in m_LocalCache)
{
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", kvp.Value.RegionName, kvp.Key);
List<GridRegion> regions = kvp.Value.GetNeighbours();
foreach (GridRegion r in regions)
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
}
}
MainConsole.Instance.Output(caps.ToString());
*/
MainConsole.Instance.Output("Neighbours list not avaiable in this version\n");
}
}
}

View File

@@ -210,7 +210,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.MapImage
return;
}
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
// mapTile.Save( // DEBUG DEBUG
// 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 (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize)
{
m_log.DebugFormat("{0} Upload maptile for {1}", LogHeader, scene.Name);
ConvertAndUploadMaptile(scene, mapTile,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY,
scene.RegionInfo.RegionName);
}
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
// pieces since that is how the maptile system works.
// Note the assumption that varregions are always a multiple of legacy size.

View File

@@ -1435,6 +1435,9 @@ namespace OpenSim.Region.CoreModules.World.Land
land.LandData.IsGroupOwned = false;
land.LandData.SalePrice = 0;
land.LandData.AuthBuyerID = UUID.Zero;
land.LandData.SeeAVs = true;
land.LandData.AnyAVSounds = true;
land.LandData.GroupAVSounds = true;
land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
m_scene.ForEachClient(SendParcelOverlay);
land.SendLandUpdateToClient(true, remote_client);

View File

@@ -40,6 +40,7 @@ using OpenSim.Framework.Console;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
namespace OpenSim.Region.CoreModules.World.Objects.Commands
{
@@ -107,6 +108,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
+ "max-agent-limit <int> - Maximum root agent limit. agent-limit cannot exceed this."
+ " This is not persisted over restart - to set it every time you must add a MaxAgents entry to your regions file.",
HandleRegionSet);
m_console.Commands.AddCommand("Regions", false, "show neighbours",
"show neighbours",
"Shows the local region neighbours", HandleShowNeighboursCommand);
m_console.Commands.AddCommand("Regions", false, "show regionsinview",
"show regionsinview",
"Shows regions that can be seen from a region", HandleShowRegionsInViewCommand);
}
public void RemoveRegion(Scene scene)
@@ -309,5 +319,60 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
MainConsole.Instance.Output(sb.ToString());
}
public void HandleShowNeighboursCommand(string module, string[] cmdparams)
{
if(m_scene == null)
return;
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
return;
System.Text.StringBuilder caps = new System.Text.StringBuilder();
RegionInfo sr = m_scene.RegionInfo;
caps.AppendFormat("*** Neighbours of {0} ({1}) ***\n", sr.RegionName, sr.RegionID);
List<GridRegion> regions = m_scene.GridService.GetNeighbours(sr.ScopeID, sr.RegionID);
foreach (GridRegion r in regions)
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
MainConsole.Instance.Output(caps.ToString());
}
public void HandleShowRegionsInViewCommand(string module, string[] cmdparams)
{
if(m_scene == null)
return;
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_scene))
return;
System.Text.StringBuilder caps = new System.Text.StringBuilder();
int maxview = (int)m_scene.MaxRegionViewDistance;
RegionInfo sr = m_scene.RegionInfo;
caps.AppendFormat("*** Regions that can be seen from {0} ({1}) (MaxRegionViewDistance {2}m) ***\n", sr.RegionName, sr.RegionID, maxview);
int startX = (int)sr.WorldLocX;
int endX = startX + (int)sr.RegionSizeX;
int startY = (int)sr.WorldLocY;
int endY = startY + (int)sr.RegionSizeY;
startX -= maxview;
if(startX < 0 )
startX = 0;
startY -= maxview;
if(startY < 0)
startY = 0;
endX += maxview;
endY += maxview;
List<GridRegion> regions = m_scene.GridService.GetRegionRange(sr.ScopeID, startX, endX, startY, endY);
foreach (GridRegion r in regions)
{
if(r.RegionHandle == sr.RegionHandle)
continue;
caps.AppendFormat(" {0} @ {1}-{2}\n", r.RegionName, Util.WorldToRegionLoc((uint)r.RegionLocX), Util.WorldToRegionLoc((uint)r.RegionLocY));
}
MainConsole.Instance.Output(caps.ToString());
}
}
}
}

View File

@@ -1122,8 +1122,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain
}
*/
int[] xPieces = new int[toSend.Count];
int[] yPieces = new int[toSend.Count];
float[] patchPieces = new float[toSend.Count * 2];
int pieceIndex = 0;
foreach (PatchesToSend pts in toSend)

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