Merge branch 'master' into httptests

This commit is contained in:
UbitUmarov
2017-05-31 07:21:21 +01:00
26 changed files with 287 additions and 682 deletions

View File

@@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return true;
// uploaded baked textures will be in assets local cache
IAssetService cache = m_scene.AssetService;
IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>();
IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
int validDirtyBakes = 0;
@@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
List<UUID> missing = new List<UUID>();
bool haveSkirt = (wearableCache[19].TextureAsset != null);
bool haveSkirt = (wearableCache[19].TextureID != UUID.Zero);
bool haveNewSkirt = false;
// Process received baked textures
@@ -436,7 +436,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
*/
wearableCache[idx].TextureAsset = null;
if (cache != null)
wearableCache[idx].TextureAsset = cache.GetCached(face.TextureID.ToString());
{
AssetBase asb = null;
cache.Get(face.TextureID.ToString(), out asb);
wearableCache[idx].TextureAsset = asb;
}
if (wearableCache[idx].TextureAsset != null)
{
@@ -481,25 +485,26 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
// if we got a full set of baked textures save all in BakedTextureModule
if (m_BakedTextureModule != null)
{
m_log.Debug("[UpdateBakedCache] start async uploading to bakedModule cache");
m_log.DebugFormat("[UpdateBakedCache] Uploading to Bakes Server: cache hits: {0} changed entries: {1} rebakes {2}",
hits.ToString(), validDirtyBakes.ToString(), missing.Count);
m_BakedTextureModule.Store(sp.UUID, wearableCache);
}
}
else
m_log.DebugFormat("[UpdateBakedCache] cache hits: {0} changed entries: {1} rebakes {2}",
hits.ToString(), validDirtyBakes.ToString(), missing.Count);
// debug
m_log.Debug("[UpdateBakedCache] cache hits: " + hits.ToString() + " changed entries: " + validDirtyBakes.ToString() + " rebakes " + missing.Count);
/*
for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
{
int j = AvatarAppearance.BAKE_INDICES[iter];
m_log.Debug("[UpdateBCache] {" + iter + "/" +
sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
sp.Appearance.WearableCacheItems[j].TextureID);
sp.Appearance.WearableCacheItems[j].TextureAsset = null;
// m_log.Debug("[UpdateBCache] {" + iter + "/" +
// sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
// sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
// sp.Appearance.WearableCacheItems[j].TextureID);
}
*/
return (hits == cacheItems.Length);
}
@@ -513,7 +518,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
lock (m_setAppearanceLock)
{
IAssetService cache = m_scene.AssetService;
IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>();
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
WearableCacheItem[] bakedModuleCache = null;
@@ -553,6 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
}
}
*/
bool wearableCacheValid = false;
if (wearableCache == null)
{
@@ -577,10 +583,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
hits++;
wearableCache[idx].TextureAsset.Temporary = true;
wearableCache[idx].TextureAsset.Local = true;
cache.Store(wearableCache[idx].TextureAsset);
cache.Cache(wearableCache[idx].TextureAsset);
wearableCache[idx].TextureAsset = null;
continue;
}
if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null)
if (cache.Check((wearableCache[idx].TextureID).ToString()))
{
hits++;
continue;
@@ -645,7 +653,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
bakedModuleCache[i].TextureAsset.Temporary = true;
bakedModuleCache[i].TextureAsset.Local = true;
cache.Store(bakedModuleCache[i].TextureAsset);
cache.Cache(bakedModuleCache[i].TextureAsset);
}
}
gotbacked = true;
@@ -677,6 +685,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
face.TextureID = wearableCache[idx].TextureID;
hits++;
wearableCache[idx].TextureAsset = null;
}
}
}
@@ -706,7 +715,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
return 0;
int texturesRebaked = 0;
// IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>();
IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>();
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
{
@@ -722,18 +731,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (missingTexturesOnly)
{
if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
if (cache != null && cache.Check(face.TextureID.ToString()))
{
continue;
}
else
{
// On inter-simulator teleports, this occurs if baked textures are not being stored by the
// grid asset service (which means that they are not available to the new region and so have
// to be re-requested from the client).
//
// The only available core OpenSimulator behaviour right now
// is not to store these textures, temporarily or otherwise.
m_log.DebugFormat(
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
face.TextureID, idx, sp.Name);

View File

@@ -1839,12 +1839,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
webRequest.ContentType = "application/json-rpc";
webRequest.Method = "POST";
using(Stream dataStream = webRequest.GetRequestStream())
dataStream.Write(content,0,content.Length);
WebResponse webResponse = null;
try
{
using(Stream dataStream = webRequest.GetRequestStream())
dataStream.Write(content,0,content.Length);
webResponse = webRequest.GetResponse();
}
catch (WebException e)
@@ -1920,12 +1920,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
webRequest.ContentType = "application/json-rpc";
webRequest.Method = "POST";
using(Stream dataStream = webRequest.GetRequestStream())
dataStream.Write(content,0,content.Length);
WebResponse webResponse = null;
try
{
using(Stream dataStream = webRequest.GetRequestStream())
dataStream.Write(content,0,content.Length);
webResponse = webRequest.GetResponse();
}
catch (WebException e)

View File

@@ -142,9 +142,9 @@ namespace OpenSim.Region.CoreModules.Framework
if (capsObjectPath == oldCaps.CapsObjectPath)
{
m_log.WarnFormat(
"[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
// m_log.WarnFormat(
// "[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
return;
}
else

View File

@@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_idCache = new ExpiringCache<ulong, DateTime>();
m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime));
}
m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime));
m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime);
}
// Remove the agent from the region's banned list
@@ -417,12 +417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
e.Message, e.StackTrace);
sp.ControllingClient.SendTeleportFailed("Internal error");
if(sp != null && sp.ControllingClient != null && !sp.IsDeleted)
sp.ControllingClient.SendTeleportFailed("Internal error");
}
finally
{
@@ -1216,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR
// IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
Thread.Sleep(15000);
Thread.Sleep(25000);
// if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
// m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
// Thread.Sleep(1000);
@@ -1487,11 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
if (neighbourRegion == null)
{
return null;
}
if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
{
failureReason = "Access Denied or Temporary not possible";
return null;
}
@@ -1503,13 +1504,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
pos.Z);
string homeURI = scene.GetAgentHomeURI(agentID);
if (!scene.SimulationService.QueryAccess(
neighbourRegion, agentID, homeURI, false, newpos,
scene.GetFormatsOffered(), ctx, out failureReason))
{
// remember the fail
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
if(String.IsNullOrWhiteSpace(failureReason))
failureReason = "Access Denied";
return null;
}
@@ -1529,13 +1532,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState;
ScenePresence agent = icon.EndInvoke(iar);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
if(!agent.IsChildAgent)
{
// crossing failed
agent.CrossToNewRegionFail();
}
else
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
agent.IsInTransit = false;
}
@@ -2153,6 +2158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
int count = 0;
IPEndPoint ipe;
foreach (GridRegion neighbour in neighbours)
{
@@ -2161,8 +2167,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{
if (newneighbours.Contains(handler))
{
InformClientOfNeighbourAsync(sp, cagents[count], neighbour,
neighbour.ExternalEndPoint, true);
ipe = neighbour.ExternalEndPoint;
if (ipe != null)
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true);
else
{
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName);
}
count++;
}
else if (!previousRegionNeighbourHandles.Contains(handler))
@@ -2278,9 +2289,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
double px, double py, uint pSizeHint)
{
m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py);
GridRegion ret = null;
const double fudge = 2.0;
if (m_notFoundLocationCache.Contains(px, py))
{

View File

@@ -35,6 +35,7 @@ using log4net;
using Mono.Addins;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces;
@@ -146,23 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
}
IPAddress ia = null;
try
{
foreach (IPAddress Adr in Dns.GetHostAddresses(ExternalHostNameForLSL))
{
if (Adr.AddressFamily == AddressFamily.InterNetwork ||
Adr.AddressFamily == AddressFamily.InterNetworkV6) // ipv6 will most likely smoke
{
ia = Adr;
break;
}
}
}
catch
{
ia = null;
}
ia = Util.GetHostFromDNS(ExternalHostNameForLSL);
if (ia == null)
{
m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled";

View File

@@ -25,44 +25,32 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net;
using Mono.Addins;
using System;
using System.Reflection;
using System.Collections.Generic;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Server.Base;
using OpenSim.Services.Connectors;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")]
public class LocalNeighbourServicesConnector :
ISharedRegionModule, INeighbourService
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServicesOutConnector")]
public class NeighbourServicesOutConnector :
NeighbourServicesConnector, ISharedRegionModule, INeighbourService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private List<Scene> m_Scenes = new List<Scene>();
private bool m_Enabled = false;
public LocalNeighbourServicesConnector()
{
}
public LocalNeighbourServicesConnector(List<Scene> scenes)
{
m_Scenes = scenes;
}
#region ISharedRegionModule
public Type ReplaceableInterface
{
get { return null; }
@@ -70,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
public string Name
{
get { return "LocalNeighbourServicesConnector"; }
get { return "NeighbourServicesOutConnector"; }
}
public void Initialise(IConfigSource source)
@@ -78,39 +66,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("NeighbourServices", this.Name);
string name = moduleConfig.GetString("NeighbourServices");
if (name == Name)
{
// m_Enabled rules whether this module registers as INeighbourService or not
m_Enabled = true;
m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled");
m_log.Info("[NEIGHBOUR CONNECTOR]: Neighbour out connector enabled");
}
}
}
public void PostInitialise()
{
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
m_Scenes.Add(scene);
if (!m_Enabled)
return;
m_Scenes.Add(scene);
scene.RegisterModuleInterface<INeighbourService>(this);
}
public void RegionLoaded(Scene scene)
{
m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName);
}
public void PostInitialise()
{
}
public void RemoveRegion(Scene scene)
{
// Always remove
@@ -118,28 +99,36 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
m_Scenes.Remove(scene);
}
#endregion ISharedRegionModule
public void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
m_GridService = scene.GridService;
m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled out neighbours for region {0}", scene.RegionInfo.RegionName);
}
#region INeighbourService
public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
{
uint x, y;
Util.RegionHandleToRegionLoc(regionHandle, out x, out y);
if (!m_Enabled)
return null;
foreach (Scene s in m_Scenes)
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
thisRegion.RegionName, s.Name, x, y );
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
// uint x, y;
// Util.RegionHandleToRegionLoc(regionHandle, out x, out y);
// m_log.DebugFormat("[NEIGHBOUR SERVICE OUT CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
// thisRegion.RegionName, s.Name, x, y );
return s.IncomingHelloNeighbour(thisRegion);
}
}
//m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
return null;
return base.HelloNeighbour(regionHandle, thisRegion);
}
#endregion INeighbourService

View File

@@ -1,157 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using Mono.Addins;
using System;
using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Services.Connectors;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
{
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "RemoteNeighbourServicesConnector")]
public class RemoteNeighbourServicesConnector :
NeighbourServicesConnector, ISharedRegionModule, INeighbourService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private bool m_Enabled = false;
private LocalNeighbourServicesConnector m_LocalService;
//private string serviceDll;
//private List<Scene> m_Scenes = new List<Scene>();
public Type ReplaceableInterface
{
get { return null; }
}
public string Name
{
get { return "RemoteNeighbourServicesConnector"; }
}
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
if (moduleConfig != null)
{
string name = moduleConfig.GetString("NeighbourServices");
if (name == Name)
{
m_LocalService = new LocalNeighbourServicesConnector();
//IConfig neighbourConfig = source.Configs["NeighbourService"];
//if (neighbourConfig == null)
//{
// m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini");
// return;
//}
//serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty);
//if (serviceDll == String.Empty)
//{
// m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService");
// return;
//}
m_Enabled = true;
m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled");
}
}
}
public void PostInitialise()
{
//if (m_Enabled)
//{
// Object[] args = new Object[] { m_Scenes };
// m_LocalService =
// ServerUtils.LoadPlugin<INeighbourService>(serviceDll,
// args);
// if (m_LocalService == null)
// {
// m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service");
// Unregister();
// return;
// }
//}
}
public void Close()
{
}
public void AddRegion(Scene scene)
{
if (!m_Enabled)
return;
m_LocalService.AddRegion(scene);
scene.RegisterModuleInterface<INeighbourService>(this);
}
public void RemoveRegion(Scene scene)
{
if (m_Enabled)
m_LocalService.RemoveRegion(scene);
}
public void RegionLoaded(Scene scene)
{
if (!m_Enabled)
return;
m_GridService = scene.GridService;
m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName);
}
#region INeighbourService
public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
{
GridRegion region = m_LocalService.HelloNeighbour(regionHandle, thisRegion);
if (region != null)
return region;
return base.HelloNeighbour(regionHandle, thisRegion);
}
#endregion INeighbourService
}
}