Merge branch 'master' into httptests
commit
55babdc160
|
@ -26,24 +26,12 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenMetaverse.Imaging;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||
|
||||
|
@ -56,13 +44,11 @@ namespace OpenSim.Capabilities.Handlers
|
|||
|
||||
private Caps m_HostCapsObj;
|
||||
private IAssetService m_assetService;
|
||||
private bool m_persistBakedTextures;
|
||||
|
||||
public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures)
|
||||
public UploadBakedTextureHandler(Caps caps, IAssetService assetService)
|
||||
{
|
||||
m_HostCapsObj = caps;
|
||||
m_assetService = assetService;
|
||||
m_persistBakedTextures = persistBakedTextures;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -125,9 +111,8 @@ namespace OpenSim.Capabilities.Handlers
|
|||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||
asset.Data = data;
|
||||
asset.Temporary = true;
|
||||
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
||||
asset.Local = true;
|
||||
m_assetService.Store(asset);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,8 +136,6 @@ namespace OpenSim.Capabilities.Handlers
|
|||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handle raw uploaded baked texture data.
|
||||
/// </summary>
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Capabilities.Handlers
|
|||
server.AddStreamHandler(new RestStreamHandler(
|
||||
"POST",
|
||||
"/CAPS/UploadBakedTexture/",
|
||||
new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
|
||||
new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture,
|
||||
"UploadBakedTexture",
|
||||
"Upload Baked Texture Capability"));
|
||||
|
||||
|
|
|
@ -428,13 +428,16 @@ namespace OpenSim.Framework
|
|||
if (WebUtil.DebugLevel >= 5)
|
||||
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
using (Stream dst = _request.GetRequestStream())
|
||||
{
|
||||
m_log.Debug("[REST]: GetRequestStream is ok");
|
||||
// m_log.Debug("[REST]: GetRequestStream is ok");
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int length = src.Read(buf, 0, 1024);
|
||||
m_log.Debug("[REST]: First Read is ok");
|
||||
// m_log.Debug("[REST]: First Read is ok");
|
||||
while (length > 0)
|
||||
{
|
||||
dst.Write(buf, 0, length);
|
||||
|
@ -442,8 +445,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_response = (HttpWebResponse)_request.GetResponse();
|
||||
}
|
||||
catch (WebException e)
|
||||
|
|
|
@ -207,7 +207,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
qu.Clear();
|
||||
m_bycontext.Clear();
|
||||
|
||||
/*
|
||||
try
|
||||
{
|
||||
foreach (PollServiceHttpRequest req in m_retryRequests)
|
||||
|
@ -220,22 +219,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
PollServiceHttpRequest wreq;
|
||||
*/
|
||||
|
||||
m_retryRequests.Clear();
|
||||
/*
|
||||
|
||||
while (m_requests.Count() > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
wreq = m_requests.Dequeue(0);
|
||||
wreq.DoHTTPstop(m_server);
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
m_requests.Clear();
|
||||
}
|
||||
|
||||
|
@ -245,7 +243,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
while (m_running)
|
||||
{
|
||||
PollServiceHttpRequest req = m_requests.Dequeue(5000);
|
||||
PollServiceHttpRequest req = m_requests.Dequeue(4500);
|
||||
Watchdog.UpdateThread();
|
||||
if(req == null)
|
||||
continue;
|
||||
|
|
|
@ -274,18 +274,6 @@ namespace OpenSim.Framework.Servers
|
|||
"Show thread status. Synonym for \"show threads\"",
|
||||
(string module, string[] args) => Notice(GetThreadsReport()));
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug comms set",
|
||||
"debug comms set serialosdreq true|false",
|
||||
"Set comms parameters. For debug purposes.",
|
||||
HandleDebugCommsSet);
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug comms status",
|
||||
"debug comms status",
|
||||
"Show current debug comms parameters.",
|
||||
HandleDebugCommsStatus);
|
||||
|
||||
m_console.Commands.AddCommand (
|
||||
"Debug", false, "debug threadpool set",
|
||||
"debug threadpool set worker|iocp min|max <n>",
|
||||
|
@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
public void RegisterCommonComponents(IConfigSource configSource)
|
||||
{
|
||||
IConfig networkConfig = configSource.Configs["Network"];
|
||||
|
||||
if (networkConfig != null)
|
||||
{
|
||||
WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
|
||||
}
|
||||
// IConfig networkConfig = configSource.Configs["Network"];
|
||||
|
||||
m_serverStatsCollector = new ServerStatsCollector();
|
||||
m_serverStatsCollector.Initialise(configSource);
|
||||
m_serverStatsCollector.Start();
|
||||
}
|
||||
|
||||
private void HandleDebugCommsStatus(string module, string[] args)
|
||||
{
|
||||
Notice("serialosdreq is {0}", WebUtil.SerializeOSDRequestsPerEndpoint);
|
||||
}
|
||||
|
||||
private void HandleDebugCommsSet(string module, string[] args)
|
||||
{
|
||||
if (args.Length != 5)
|
||||
{
|
||||
Notice("Usage: debug comms set serialosdreq true|false");
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[3] != "serialosdreq")
|
||||
{
|
||||
Notice("Usage: debug comms set serialosdreq true|false");
|
||||
return;
|
||||
}
|
||||
|
||||
bool setSerializeOsdRequests;
|
||||
|
||||
if (!ConsoleUtil.TryParseConsoleBool(m_console, args[4], out setSerializeOsdRequests))
|
||||
return;
|
||||
|
||||
WebUtil.SerializeOSDRequestsPerEndpoint = setSerializeOsdRequests;
|
||||
|
||||
Notice("serialosdreq is now {0}", setSerializeOsdRequests);
|
||||
}
|
||||
|
||||
private void HandleShowThreadpoolCallsActive(string module, string[] args)
|
||||
{
|
||||
List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList();
|
||||
|
|
|
@ -429,64 +429,6 @@ namespace OpenSim.Framework
|
|||
return regionCoord << 8;
|
||||
}
|
||||
|
||||
public static IPEndPoint getEndPoint(IPAddress ia, int port)
|
||||
{
|
||||
if(ia == null)
|
||||
return null;
|
||||
|
||||
IPEndPoint newEP = null;
|
||||
try
|
||||
{
|
||||
newEP = new IPEndPoint(ia, port);
|
||||
}
|
||||
catch
|
||||
{
|
||||
newEP = null;
|
||||
}
|
||||
return newEP;
|
||||
}
|
||||
|
||||
public static IPEndPoint getEndPoint(string hostname, int port)
|
||||
{
|
||||
IPAddress ia = null;
|
||||
// If it is already an IP, don't resolve it - just return directly
|
||||
// we should not need this
|
||||
if (IPAddress.TryParse(hostname, out ia))
|
||||
{
|
||||
if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
|
||||
return null;
|
||||
return getEndPoint(ia, port);
|
||||
}
|
||||
|
||||
// Reset for next check
|
||||
ia = null;
|
||||
try
|
||||
{
|
||||
foreach (IPAddress Adr in Dns.GetHostAddresses(hostname))
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
||||
if (Adr.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch // (SocketException e)
|
||||
{
|
||||
/*throw new Exception(
|
||||
"Unable to resolve local hostname " + m_externalHostName + " innerException of type '" +
|
||||
e + "' attached to this exception", e);*/
|
||||
// Don't throw a fatal exception here, instead, return Null and handle it in the caller.
|
||||
// Reason is, on systems such as OSgrid it has occured that known hostnames stop
|
||||
// resolving and thus make surrounding regions crash out with this exception.
|
||||
return null;
|
||||
}
|
||||
|
||||
return getEndPoint(ia,port);
|
||||
}
|
||||
|
||||
public static bool checkServiceURI(string uristr, out string serviceURI)
|
||||
{
|
||||
|
@ -1049,6 +991,8 @@ namespace OpenSim.Framework
|
|||
return output.ToString();
|
||||
}
|
||||
|
||||
private static ExpiringCache<string,IPAddress> dnscache = new ExpiringCache<string, IPAddress>();
|
||||
|
||||
/// <summary>
|
||||
/// Converts a URL to a IPAddress
|
||||
/// </summary>
|
||||
|
@ -1066,40 +1010,130 @@ namespace OpenSim.Framework
|
|||
/// <returns>An IP address, or null</returns>
|
||||
public static IPAddress GetHostFromDNS(string dnsAddress)
|
||||
{
|
||||
// Is it already a valid IP? No need to look it up.
|
||||
IPAddress ipa;
|
||||
if (IPAddress.TryParse(dnsAddress, out ipa))
|
||||
return ipa;
|
||||
if(String.IsNullOrWhiteSpace(dnsAddress))
|
||||
return null;
|
||||
|
||||
IPAddress[] hosts = null;
|
||||
IPAddress ia = null;
|
||||
if(dnscache.TryGetValue(dnsAddress, out ia) && ia != null)
|
||||
{
|
||||
dnscache.AddOrUpdate(dnsAddress, ia, 300);
|
||||
return ia;
|
||||
}
|
||||
|
||||
// Not an IP, lookup required
|
||||
ia = null;
|
||||
// If it is already an IP, don't let GetHostEntry see it
|
||||
if (IPAddress.TryParse(dnsAddress, out ia) && ia != null)
|
||||
{
|
||||
if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
|
||||
return null;
|
||||
dnscache.AddOrUpdate(dnsAddress, ia, 300);
|
||||
return ia;
|
||||
}
|
||||
|
||||
IPHostEntry IPH;
|
||||
try
|
||||
{
|
||||
hosts = Dns.GetHostEntry(dnsAddress).AddressList;
|
||||
IPH = Dns.GetHostEntry(dnsAddress);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch // (SocketException e)
|
||||
{
|
||||
m_log.WarnFormat("[UTIL]: An error occurred while resolving host name {0}, {1}", dnsAddress, e);
|
||||
|
||||
// Still going to throw the exception on for now, since this was what was happening in the first place
|
||||
throw e;
|
||||
}
|
||||
|
||||
foreach (IPAddress host in hosts)
|
||||
{
|
||||
if (host.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
if (hosts.Length > 0)
|
||||
return hosts[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if(IPH == null || IPH.AddressList.Length == 0)
|
||||
return null;
|
||||
|
||||
ia = null;
|
||||
foreach (IPAddress Adr in IPH.AddressList)
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
||||
if (Adr.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ia != null)
|
||||
dnscache.AddOrUpdate(dnsAddress, ia, 300);
|
||||
return ia;
|
||||
}
|
||||
|
||||
public static IPEndPoint getEndPoint(IPAddress ia, int port)
|
||||
{
|
||||
if(ia == null)
|
||||
return null;
|
||||
|
||||
IPEndPoint newEP = null;
|
||||
try
|
||||
{
|
||||
newEP = new IPEndPoint(ia, port);
|
||||
}
|
||||
catch
|
||||
{
|
||||
newEP = null;
|
||||
}
|
||||
return newEP;
|
||||
}
|
||||
|
||||
public static IPEndPoint getEndPoint(string hostname, int port)
|
||||
{
|
||||
if(String.IsNullOrWhiteSpace(hostname))
|
||||
return null;
|
||||
|
||||
IPAddress ia = null;
|
||||
if(dnscache.TryGetValue(hostname, out ia) && ia != null)
|
||||
{
|
||||
dnscache.AddOrUpdate(hostname, ia, 300);
|
||||
return getEndPoint(ia, port);
|
||||
}
|
||||
|
||||
ia = null;
|
||||
|
||||
// If it is already an IP, don't let GetHostEntry see it
|
||||
if (IPAddress.TryParse(hostname, out ia) && ia != null)
|
||||
{
|
||||
if (ia.Equals(IPAddress.Any) || ia.Equals(IPAddress.IPv6Any))
|
||||
return null;
|
||||
|
||||
dnscache.AddOrUpdate(hostname, ia, 300);
|
||||
return getEndPoint(ia, port);
|
||||
}
|
||||
|
||||
|
||||
IPHostEntry IPH;
|
||||
try
|
||||
{
|
||||
IPH = Dns.GetHostEntry(hostname);
|
||||
}
|
||||
catch // (SocketException e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if(IPH == null || IPH.AddressList.Length == 0)
|
||||
return null;
|
||||
|
||||
ia = null;
|
||||
foreach (IPAddress Adr in IPH.AddressList)
|
||||
{
|
||||
if (ia == null)
|
||||
ia = Adr;
|
||||
|
||||
if (Adr.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
ia = Adr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(ia != null)
|
||||
dnscache.AddOrUpdate(hostname, ia, 300);
|
||||
|
||||
return getEndPoint(ia,port);
|
||||
}
|
||||
|
||||
public static Uri GetURI(string protocol, string hostname, int port, string path)
|
||||
{
|
||||
return new UriBuilder(protocol, hostname, port, path).Uri;
|
||||
|
|
|
@ -71,11 +71,6 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public static int RequestNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Control where OSD requests should be serialized per endpoint.
|
||||
/// </summary>
|
||||
public static bool SerializeOSDRequestsPerEndpoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// this is the header field used to communicate the local request id
|
||||
/// used for performance and debugging
|
||||
|
@ -98,31 +93,6 @@ namespace OpenSim.Framework
|
|||
/// </remarks>
|
||||
public const int MaxRequestDiagLength = 200;
|
||||
|
||||
/// <summary>
|
||||
/// Dictionary of end points
|
||||
/// </summary>
|
||||
private static Dictionary<string,object> m_endpointSerializer = new Dictionary<string,object>();
|
||||
|
||||
private static object EndPointLock(string url)
|
||||
{
|
||||
System.Uri uri = new System.Uri(url);
|
||||
string endpoint = string.Format("{0}:{1}",uri.Host,uri.Port);
|
||||
|
||||
lock (m_endpointSerializer)
|
||||
{
|
||||
object eplock = null;
|
||||
|
||||
if (! m_endpointSerializer.TryGetValue(endpoint,out eplock))
|
||||
{
|
||||
eplock = new object();
|
||||
m_endpointSerializer.Add(endpoint,eplock);
|
||||
// m_log.WarnFormat("[WEB UTIL] add a new host to end point serializer {0}",endpoint);
|
||||
}
|
||||
|
||||
return eplock;
|
||||
}
|
||||
}
|
||||
|
||||
#region JSONRequest
|
||||
|
||||
/// <summary>
|
||||
|
@ -154,21 +124,6 @@ namespace OpenSim.Framework
|
|||
return ServiceOSDRequest(url, null, "GET", timeout, false, false);
|
||||
}
|
||||
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
{
|
||||
if (SerializeOSDRequestsPerEndpoint)
|
||||
{
|
||||
lock (EndPointLock(url))
|
||||
{
|
||||
return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ServiceOSDRequestWorker(url, data, method, timeout, compressed, rpc);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LogOutgoingDetail(Stream outputStream)
|
||||
{
|
||||
LogOutgoingDetail("", outputStream);
|
||||
|
@ -222,7 +177,7 @@ namespace OpenSim.Framework
|
|||
LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input);
|
||||
}
|
||||
|
||||
private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
public static OSDMap ServiceOSDRequest(string url, OSDMap data, string method, int timeout, bool compressed, bool rpc)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
|
||||
|
@ -421,14 +376,6 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
lock (EndPointLock(url))
|
||||
{
|
||||
return ServiceFormRequestWorker(url,data,timeout);
|
||||
}
|
||||
}
|
||||
|
||||
private static OSDMap ServiceFormRequestWorker(string url, NameValueCollection data, int timeout)
|
||||
{
|
||||
int reqnum = RequestNumber++;
|
||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||
|
|
|
@ -79,10 +79,9 @@ namespace OpenSim
|
|||
else
|
||||
{
|
||||
ServicePointManager.DefaultConnectionLimit = 12;
|
||||
try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some crazy mono decides to have it infinity
|
||||
catch { }
|
||||
}
|
||||
|
||||
try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
|
||||
ServicePointManager.Expect100Continue = false;
|
||||
ServicePointManager.UseNagleAlgorithm = false;
|
||||
|
||||
|
|
|
@ -63,9 +63,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
private static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
|
||||
|
||||
private Scene m_scene;
|
||||
private bool m_persistBakedTextures;
|
||||
|
||||
private IBakedTextureModule m_BakedTextureModule;
|
||||
private string m_URL;
|
||||
|
||||
public void Initialise(IConfigSource source)
|
||||
|
@ -76,15 +74,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
|
||||
|
||||
IConfig appearanceConfig = source.Configs["Appearance"];
|
||||
if (appearanceConfig != null)
|
||||
m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
||||
// IConfig appearanceConfig = source.Configs["Appearance"];
|
||||
}
|
||||
|
||||
public void AddRegion(Scene s)
|
||||
{
|
||||
m_scene = s;
|
||||
|
||||
}
|
||||
|
||||
public void RemoveRegion(Scene s)
|
||||
|
@ -92,7 +87,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
s.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||
s.EventManager.OnNewPresence -= RegisterNewPresence;
|
||||
s.EventManager.OnRemovePresence -= DeRegisterPresence;
|
||||
m_BakedTextureModule = null;
|
||||
m_scene = null;
|
||||
}
|
||||
|
||||
|
@ -101,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||
m_scene.EventManager.OnNewPresence += RegisterNewPresence;
|
||||
m_scene.EventManager.OnRemovePresence += DeRegisterPresence;
|
||||
|
||||
}
|
||||
|
||||
private void DeRegisterPresence(UUID agentId)
|
||||
|
@ -110,156 +103,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
|
||||
private void RegisterNewPresence(ScenePresence presence)
|
||||
{
|
||||
// presence.ControllingClient.OnSetAppearance += CaptureAppearanceSettings;
|
||||
}
|
||||
|
||||
/* not in use. work done in AvatarFactoryModule ValidateBakedTextureCache() and UpdateBakedTextureCache()
|
||||
private void CaptureAppearanceSettings(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 avSize, WearableCacheItem[] cacheItems)
|
||||
{
|
||||
// if cacheItems.Length > 0 viewer is giving us current textures information.
|
||||
// baked ones should had been uploaded and in assets cache as local itens
|
||||
|
||||
|
||||
if (cacheItems.Length == 0)
|
||||
return; // no textures information, nothing to do
|
||||
|
||||
ScenePresence p = null;
|
||||
if (!m_scene.TryGetScenePresence(remoteClient.AgentId, out p))
|
||||
return; // what are we doing if there is no presence to cache for?
|
||||
|
||||
if (p.IsDeleted)
|
||||
return; // does this really work?
|
||||
|
||||
int maxCacheitemsLoop = cacheItems.Length;
|
||||
if (maxCacheitemsLoop > 20)
|
||||
{
|
||||
maxCacheitemsLoop = AvatarWearable.MAX_WEARABLES;
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Too Many Cache items Provided {0}, the max is {1}. Truncating!", cacheItems.Length, AvatarWearable.MAX_WEARABLES);
|
||||
}
|
||||
|
||||
m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||
|
||||
|
||||
// some nice debug
|
||||
m_log.Debug("[Cacheitems]: " + cacheItems.Length);
|
||||
for (int iter = 0; iter < maxCacheitemsLoop; iter++)
|
||||
{
|
||||
m_log.Debug("[Cacheitems] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
|
||||
cacheItems[iter].TextureID);
|
||||
}
|
||||
|
||||
// p.Appearance.WearableCacheItems is in memory primary cashID to textures mapper
|
||||
|
||||
WearableCacheItem[] existingitems = p.Appearance.WearableCacheItems;
|
||||
|
||||
if (existingitems == null)
|
||||
{
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
WearableCacheItem[] savedcache = null;
|
||||
try
|
||||
{
|
||||
if (p.Appearance.WearableCacheItemsDirty)
|
||||
{
|
||||
savedcache = m_BakedTextureModule.Get(p.UUID);
|
||||
p.Appearance.WearableCacheItems = savedcache;
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
catch (Exception)
|
||||
{
|
||||
// The service logs a sufficient error message.
|
||||
}
|
||||
|
||||
|
||||
if (savedcache != null)
|
||||
existingitems = savedcache;
|
||||
}
|
||||
}
|
||||
|
||||
// Existing items null means it's a fully new appearance
|
||||
if (existingitems == null)
|
||||
{
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
{
|
||||
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
|
||||
if (face == null)
|
||||
{
|
||||
textureEntry.CreateFace(cacheItems[i].TextureIndex);
|
||||
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
|
||||
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
continue;
|
||||
}
|
||||
cacheItems[i].TextureID = face.TextureID;
|
||||
if (m_scene.AssetService != null)
|
||||
cacheItems[i].TextureAsset =
|
||||
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (textureEntry.FaceTextures.Length > cacheItems[i].TextureIndex)
|
||||
{
|
||||
Primitive.TextureEntryFace face = textureEntry.FaceTextures[cacheItems[i].TextureIndex];
|
||||
if (face == null)
|
||||
{
|
||||
textureEntry.CreateFace(cacheItems[i].TextureIndex);
|
||||
textureEntry.FaceTextures[cacheItems[i].TextureIndex].TextureID =
|
||||
AppearanceManager.DEFAULT_AVATAR_TEXTURE;
|
||||
continue;
|
||||
}
|
||||
cacheItems[i].TextureID =
|
||||
face.TextureID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[CACHEDBAKES]: Invalid Texture Index Provided, Texture doesn't exist or hasn't been uploaded yet {0}, the max is {1}. Skipping!", cacheItems[i].TextureIndex, textureEntry.FaceTextures.Length);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxCacheitemsLoop; i++)
|
||||
{
|
||||
if (cacheItems[i].TextureAsset == null)
|
||||
{
|
||||
cacheItems[i].TextureAsset =
|
||||
m_scene.AssetService.GetCached(cacheItems[i].TextureID.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
p.Appearance.WearableCacheItems = cacheItems;
|
||||
|
||||
if (m_BakedTextureModule != null)
|
||||
{
|
||||
m_BakedTextureModule.Store(remoteClient.AgentId, cacheItems);
|
||||
p.Appearance.WearableCacheItemsDirty = true;
|
||||
|
||||
}
|
||||
else
|
||||
p.Appearance.WearableCacheItemsDirty = false;
|
||||
|
||||
for (int iter = 0; iter < maxCacheitemsLoop; iter++)
|
||||
{
|
||||
m_log.Debug("[CacheitemsLeaving] {" + iter + "/" + cacheItems[iter].TextureIndex + "}: c-" + cacheItems[iter].CacheId + ", t-" +
|
||||
cacheItems[iter].TextureID);
|
||||
}
|
||||
}
|
||||
*/
|
||||
public void PostInitialise()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Close() { }
|
||||
|
||||
public string Name { get { return "UploadBakedTextureModule"; } }
|
||||
|
@ -275,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
|||
if (m_URL == "localhost")
|
||||
{
|
||||
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
||||
caps, m_scene.AssetService, m_persistBakedTextures);
|
||||
caps, m_scene.AssetService);
|
||||
|
||||
caps.RegisterHandler(
|
||||
"UploadBakedTexture",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,11 +417,12 @@ 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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1510,6 +1511,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
{
|
||||
// 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))
|
||||
{
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using OpenSim.Framework;
|
||||
|
||||
|
@ -525,7 +526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
}
|
||||
|
||||
[Serializable]
|
||||
public struct list
|
||||
public class list
|
||||
{
|
||||
private object[] m_data;
|
||||
|
||||
|
@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
|
||||
public string ToCSV()
|
||||
{
|
||||
string ret = "";
|
||||
foreach (object o in this.Data)
|
||||
if(m_data == null || m_data.Length == 0)
|
||||
return String.Empty;
|
||||
|
||||
Object o = m_data[0];
|
||||
int len = m_data.Length;
|
||||
if(len == 1)
|
||||
return o.ToString();
|
||||
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
sb.Append(o.ToString());
|
||||
for(int i = 1 ; i < len; i++)
|
||||
{
|
||||
if (ret == "")
|
||||
{
|
||||
ret = o.ToString();
|
||||
sb.Append(",");
|
||||
sb.Append(o.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = ret + ", " + o.ToString();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private string ToSoup()
|
||||
{
|
||||
string output;
|
||||
output = String.Empty;
|
||||
if (Data.Length == 0)
|
||||
{
|
||||
if(m_data == null || m_data.Length == 0)
|
||||
return String.Empty;
|
||||
}
|
||||
foreach (object o in Data)
|
||||
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
foreach (object o in m_data)
|
||||
{
|
||||
output = output + o.ToString();
|
||||
sb.Append(o.ToString());
|
||||
}
|
||||
return output;
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static explicit operator String(list l)
|
||||
|
@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
|||
|
||||
public string ToPrettyString()
|
||||
{
|
||||
string output;
|
||||
if (Data.Length == 0)
|
||||
{
|
||||
if(m_data == null || m_data.Length == 0)
|
||||
return "[]";
|
||||
}
|
||||
output = "[";
|
||||
foreach (object o in Data)
|
||||
|
||||
StringBuilder sb = new StringBuilder(1024);
|
||||
int len = m_data.Length;
|
||||
int last = len - 1;
|
||||
object o;
|
||||
|
||||
sb.Append("[");
|
||||
for(int i = 0; i < len; i++ )
|
||||
{
|
||||
o = m_data[i];
|
||||
if (o is String)
|
||||
{
|
||||
output = output + "\"" + o + "\", ";
|
||||
sb.Append("\"");
|
||||
sb.Append((String)o);
|
||||
sb.Append("\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
output = output + o.ToString() + ", ";
|
||||
sb.Append(o.ToString());
|
||||
}
|
||||
if(i < last)
|
||||
sb.Append(",");
|
||||
}
|
||||
output = output.Substring(0, output.Length - 2);
|
||||
output = output + "]";
|
||||
return output;
|
||||
sb.Append("]");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public class AlphaCompare : IComparer
|
||||
|
|
|
@ -82,8 +82,7 @@ namespace OpenSim.Server
|
|||
ServicePointManager.UseNagleAlgorithm = false;
|
||||
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
|
||||
|
||||
try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity
|
||||
catch { }
|
||||
try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
|
||||
|
||||
m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
|
||||
|
||||
|
|
|
@ -70,10 +70,15 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
|||
{
|
||||
Uri m_Uri = new Uri(m_ServerURL);
|
||||
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
||||
if(ip != null)
|
||||
{
|
||||
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString());
|
||||
if (!m_ServerURL.EndsWith("/"))
|
||||
m_ServerURL += "/";
|
||||
}
|
||||
else
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Failed to resolv address of {0}", url);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[USER AGENT CONNECTOR]: Malformed Uri {0}: {1}", url, e.Message);
|
||||
|
|
|
@ -295,9 +295,6 @@ namespace OpenSim.Services.Connectors.Simulation
|
|||
|
||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
|
||||
|
||||
IPEndPoint ext = destination.ExternalEndPoint;
|
||||
if (ext == null) return false;
|
||||
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/";
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
InventoryServices = "RemoteXInventoryServicesConnector"
|
||||
GridServices = "RemoteGridServicesConnector"
|
||||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
InventoryServices = "HGInventoryBroker"
|
||||
GridServices = "RemoteGridServicesConnector"
|
||||
AvatarServices = "RemoteAvatarServicesConnector"
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
PresenceServices = "RemotePresenceServicesConnector"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
InventoryServices = "HGInventoryBroker"
|
||||
AvatarServices = "SimianAvatarServiceConnector"
|
||||
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
EntityTransferModule = "HGEntityTransferModule"
|
||||
InventoryAccessModule = "HGInventoryAccessModule"
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
InventoryServices = "SimianInventoryServiceConnector"
|
||||
AvatarServices = "SimianAvatarServiceConnector"
|
||||
|
||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
SimulationServices = "RemoteSimulationConnectorModule"
|
||||
EntityTransferModule = "BasicEntityTransferModule"
|
||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
[Modules]
|
||||
AssetServices = "LocalAssetServicesConnector"
|
||||
InventoryServices = "LocalInventoryServicesConnector"
|
||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
GridServices = "LocalGridServicesConnector"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[Modules]
|
||||
AssetServices = "HGAssetBroker"
|
||||
InventoryServices = "HGInventoryBroker"
|
||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
||||
NeighbourServices = "NeighbourServicesOutConnector"
|
||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||
GridServices = "LocalGridServicesConnector"
|
||||
|
|
Loading…
Reference in New Issue