Merge branch 'master' into httptests
commit
55babdc160
|
@ -26,24 +26,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
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.Reflection;
|
||||||
using System.IO;
|
|
||||||
using System.Web;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
|
||||||
using OpenMetaverse.Imaging;
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Capabilities;
|
using OpenSim.Framework.Capabilities;
|
||||||
using OpenSim.Framework.Servers;
|
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using Caps = OpenSim.Framework.Capabilities.Caps;
|
using Caps = OpenSim.Framework.Capabilities.Caps;
|
||||||
|
|
||||||
|
@ -56,13 +44,11 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
private Caps m_HostCapsObj;
|
private Caps m_HostCapsObj;
|
||||||
private IAssetService m_assetService;
|
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_HostCapsObj = caps;
|
||||||
m_assetService = assetService;
|
m_assetService = assetService;
|
||||||
m_persistBakedTextures = persistBakedTextures;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -125,9 +111,8 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
|
||||||
asset.Data = data;
|
asset.Data = data;
|
||||||
asset.Temporary = true;
|
asset.Temporary = true;
|
||||||
asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are
|
asset.Local = true;
|
||||||
m_assetService.Store(asset);
|
m_assetService.Store(asset);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,8 +136,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
// m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle raw uploaded baked texture data.
|
/// Handle raw uploaded baked texture data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
server.AddStreamHandler(new RestStreamHandler(
|
server.AddStreamHandler(new RestStreamHandler(
|
||||||
"POST",
|
"POST",
|
||||||
"/CAPS/UploadBakedTexture/",
|
"/CAPS/UploadBakedTexture/",
|
||||||
new UploadBakedTextureHandler(caps, m_AssetService, true).UploadBakedTexture,
|
new UploadBakedTextureHandler(caps, m_AssetService).UploadBakedTexture,
|
||||||
"UploadBakedTexture",
|
"UploadBakedTexture",
|
||||||
"Upload Baked Texture Capability"));
|
"Upload Baked Texture Capability"));
|
||||||
|
|
||||||
|
|
|
@ -428,22 +428,23 @@ namespace OpenSim.Framework
|
||||||
if (WebUtil.DebugLevel >= 5)
|
if (WebUtil.DebugLevel >= 5)
|
||||||
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
|
WebUtil.LogOutgoingDetail(string.Format("SEND {0}: ", reqnum), src);
|
||||||
|
|
||||||
using (Stream dst = _request.GetRequestStream())
|
|
||||||
{
|
|
||||||
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");
|
|
||||||
while (length > 0)
|
|
||||||
{
|
|
||||||
dst.Write(buf, 0, length);
|
|
||||||
length = src.Read(buf, 0, 1024);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using (Stream dst = _request.GetRequestStream())
|
||||||
|
{
|
||||||
|
// 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");
|
||||||
|
while (length > 0)
|
||||||
|
{
|
||||||
|
dst.Write(buf, 0, length);
|
||||||
|
length = src.Read(buf, 0, 1024);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_response = (HttpWebResponse)_request.GetResponse();
|
_response = (HttpWebResponse)_request.GetResponse();
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
|
|
|
@ -207,7 +207,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
qu.Clear();
|
qu.Clear();
|
||||||
m_bycontext.Clear();
|
m_bycontext.Clear();
|
||||||
|
|
||||||
/*
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (PollServiceHttpRequest req in m_retryRequests)
|
foreach (PollServiceHttpRequest req in m_retryRequests)
|
||||||
|
@ -220,22 +219,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
|
|
||||||
PollServiceHttpRequest wreq;
|
PollServiceHttpRequest wreq;
|
||||||
*/
|
|
||||||
m_retryRequests.Clear();
|
m_retryRequests.Clear();
|
||||||
/*
|
|
||||||
while (m_requests.Count() > 0)
|
while (m_requests.Count() > 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wreq = m_requests.Dequeue(0);
|
wreq = m_requests.Dequeue(0);
|
||||||
wreq.DoHTTPstop(m_server);
|
wreq.DoHTTPstop(m_server);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
m_requests.Clear();
|
m_requests.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +243,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
while (m_running)
|
while (m_running)
|
||||||
{
|
{
|
||||||
PollServiceHttpRequest req = m_requests.Dequeue(5000);
|
PollServiceHttpRequest req = m_requests.Dequeue(4500);
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
if(req == null)
|
if(req == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -274,18 +274,6 @@ namespace OpenSim.Framework.Servers
|
||||||
"Show thread status. Synonym for \"show threads\"",
|
"Show thread status. Synonym for \"show threads\"",
|
||||||
(string module, string[] args) => Notice(GetThreadsReport()));
|
(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 (
|
m_console.Commands.AddCommand (
|
||||||
"Debug", false, "debug threadpool set",
|
"Debug", false, "debug threadpool set",
|
||||||
"debug threadpool set worker|iocp min|max <n>",
|
"debug threadpool set worker|iocp min|max <n>",
|
||||||
|
@ -343,47 +331,13 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
public void RegisterCommonComponents(IConfigSource configSource)
|
public void RegisterCommonComponents(IConfigSource configSource)
|
||||||
{
|
{
|
||||||
IConfig networkConfig = configSource.Configs["Network"];
|
// IConfig networkConfig = configSource.Configs["Network"];
|
||||||
|
|
||||||
if (networkConfig != null)
|
|
||||||
{
|
|
||||||
WebUtil.SerializeOSDRequestsPerEndpoint = networkConfig.GetBoolean("SerializeOSDRequests", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_serverStatsCollector = new ServerStatsCollector();
|
m_serverStatsCollector = new ServerStatsCollector();
|
||||||
m_serverStatsCollector.Initialise(configSource);
|
m_serverStatsCollector.Initialise(configSource);
|
||||||
m_serverStatsCollector.Start();
|
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)
|
private void HandleShowThreadpoolCallsActive(string module, string[] args)
|
||||||
{
|
{
|
||||||
List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList();
|
List<KeyValuePair<string, int>> calls = Util.GetFireAndForgetCallsInProgress().ToList();
|
||||||
|
|
|
@ -429,64 +429,6 @@ namespace OpenSim.Framework
|
||||||
return regionCoord << 8;
|
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)
|
public static bool checkServiceURI(string uristr, out string serviceURI)
|
||||||
{
|
{
|
||||||
|
@ -1049,6 +991,8 @@ namespace OpenSim.Framework
|
||||||
return output.ToString();
|
return output.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ExpiringCache<string,IPAddress> dnscache = new ExpiringCache<string, IPAddress>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a URL to a IPAddress
|
/// Converts a URL to a IPAddress
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1066,38 +1010,128 @@ namespace OpenSim.Framework
|
||||||
/// <returns>An IP address, or null</returns>
|
/// <returns>An IP address, or null</returns>
|
||||||
public static IPAddress GetHostFromDNS(string dnsAddress)
|
public static IPAddress GetHostFromDNS(string dnsAddress)
|
||||||
{
|
{
|
||||||
// Is it already a valid IP? No need to look it up.
|
if(String.IsNullOrWhiteSpace(dnsAddress))
|
||||||
IPAddress ipa;
|
return null;
|
||||||
if (IPAddress.TryParse(dnsAddress, out ipa))
|
|
||||||
return ipa;
|
|
||||||
|
|
||||||
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
|
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);
|
return null;
|
||||||
|
|
||||||
// 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(IPH == null || IPH.AddressList.Length == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
ia = null;
|
||||||
|
foreach (IPAddress Adr in IPH.AddressList)
|
||||||
{
|
{
|
||||||
if (host.AddressFamily == AddressFamily.InterNetwork)
|
if (ia == null)
|
||||||
|
ia = Adr;
|
||||||
|
|
||||||
|
if (Adr.AddressFamily == AddressFamily.InterNetwork)
|
||||||
{
|
{
|
||||||
return host;
|
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 (hosts.Length > 0)
|
if(ia != null)
|
||||||
return hosts[0];
|
dnscache.AddOrUpdate(hostname, ia, 300);
|
||||||
|
|
||||||
return null;
|
return getEndPoint(ia,port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri GetURI(string protocol, string hostname, int port, string path)
|
public static Uri GetURI(string protocol, string hostname, int port, string path)
|
||||||
|
|
|
@ -71,11 +71,6 @@ namespace OpenSim.Framework
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int RequestNumber { get; set; }
|
public static int RequestNumber { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Control where OSD requests should be serialized per endpoint.
|
|
||||||
/// </summary>
|
|
||||||
public static bool SerializeOSDRequestsPerEndpoint { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// this is the header field used to communicate the local request id
|
/// this is the header field used to communicate the local request id
|
||||||
/// used for performance and debugging
|
/// used for performance and debugging
|
||||||
|
@ -98,31 +93,6 @@ namespace OpenSim.Framework
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public const int MaxRequestDiagLength = 200;
|
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
|
#region JSONRequest
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -154,21 +124,6 @@ namespace OpenSim.Framework
|
||||||
return ServiceOSDRequest(url, null, "GET", timeout, false, false);
|
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)
|
public static void LogOutgoingDetail(Stream outputStream)
|
||||||
{
|
{
|
||||||
LogOutgoingDetail("", outputStream);
|
LogOutgoingDetail("", outputStream);
|
||||||
|
@ -222,7 +177,7 @@ namespace OpenSim.Framework
|
||||||
LogOutgoingDetail(string.Format("RESPONSE {0}: ", reqnum), input);
|
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++;
|
int reqnum = RequestNumber++;
|
||||||
|
|
||||||
|
@ -421,14 +376,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout)
|
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++;
|
int reqnum = RequestNumber++;
|
||||||
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
string method = (data != null && data["RequestMethod"] != null) ? data["RequestMethod"] : "unknown";
|
||||||
|
|
|
@ -79,10 +79,9 @@ namespace OpenSim
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ServicePointManager.DefaultConnectionLimit = 12;
|
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.Expect100Continue = false;
|
||||||
ServicePointManager.UseNagleAlgorithm = 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 static readonly string m_uploadBakedTexturePath = "0010/";// This is in the LandManagementModule.
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
private bool m_persistBakedTextures;
|
|
||||||
|
|
||||||
private IBakedTextureModule m_BakedTextureModule;
|
|
||||||
private string m_URL;
|
private string m_URL;
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -76,15 +74,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
|
m_URL = config.GetString("Cap_UploadBakedTexture", string.Empty);
|
||||||
|
|
||||||
IConfig appearanceConfig = source.Configs["Appearance"];
|
// IConfig appearanceConfig = source.Configs["Appearance"];
|
||||||
if (appearanceConfig != null)
|
|
||||||
m_persistBakedTextures = appearanceConfig.GetBoolean("PersistBakedTextures", m_persistBakedTextures);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene s)
|
public void AddRegion(Scene s)
|
||||||
{
|
{
|
||||||
m_scene = s;
|
m_scene = s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene s)
|
public void RemoveRegion(Scene s)
|
||||||
|
@ -92,7 +87,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
s.EventManager.OnRegisterCaps -= RegisterCaps;
|
s.EventManager.OnRegisterCaps -= RegisterCaps;
|
||||||
s.EventManager.OnNewPresence -= RegisterNewPresence;
|
s.EventManager.OnNewPresence -= RegisterNewPresence;
|
||||||
s.EventManager.OnRemovePresence -= DeRegisterPresence;
|
s.EventManager.OnRemovePresence -= DeRegisterPresence;
|
||||||
m_BakedTextureModule = null;
|
|
||||||
m_scene = null;
|
m_scene = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +95,6 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
m_scene.EventManager.OnRegisterCaps += RegisterCaps;
|
||||||
m_scene.EventManager.OnNewPresence += RegisterNewPresence;
|
m_scene.EventManager.OnNewPresence += RegisterNewPresence;
|
||||||
m_scene.EventManager.OnRemovePresence += DeRegisterPresence;
|
m_scene.EventManager.OnRemovePresence += DeRegisterPresence;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeRegisterPresence(UUID agentId)
|
private void DeRegisterPresence(UUID agentId)
|
||||||
|
@ -110,156 +103,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private void RegisterNewPresence(ScenePresence presence)
|
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 PostInitialise()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Close() { }
|
public void Close() { }
|
||||||
|
|
||||||
public string Name { get { return "UploadBakedTextureModule"; } }
|
public string Name { get { return "UploadBakedTextureModule"; } }
|
||||||
|
@ -275,7 +124,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
if (m_URL == "localhost")
|
if (m_URL == "localhost")
|
||||||
{
|
{
|
||||||
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
UploadBakedTextureHandler avatarhandler = new UploadBakedTextureHandler(
|
||||||
caps, m_scene.AssetService, m_persistBakedTextures);
|
caps, m_scene.AssetService);
|
||||||
|
|
||||||
caps.RegisterHandler(
|
caps.RegisterHandler(
|
||||||
"UploadBakedTexture",
|
"UploadBakedTexture",
|
||||||
|
|
|
@ -369,7 +369,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// uploaded baked textures will be in assets local cache
|
// 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>();
|
IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||||
|
|
||||||
int validDirtyBakes = 0;
|
int validDirtyBakes = 0;
|
||||||
|
@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
List<UUID> missing = new List<UUID>();
|
List<UUID> missing = new List<UUID>();
|
||||||
|
|
||||||
bool haveSkirt = (wearableCache[19].TextureAsset != null);
|
bool haveSkirt = (wearableCache[19].TextureID != UUID.Zero);
|
||||||
bool haveNewSkirt = false;
|
bool haveNewSkirt = false;
|
||||||
|
|
||||||
// Process received baked textures
|
// Process received baked textures
|
||||||
|
@ -436,7 +436,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
*/
|
*/
|
||||||
wearableCache[idx].TextureAsset = null;
|
wearableCache[idx].TextureAsset = null;
|
||||||
if (cache != 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)
|
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 we got a full set of baked textures save all in BakedTextureModule
|
||||||
if (m_BakedTextureModule != null)
|
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);
|
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++)
|
for (int iter = 0; iter < AvatarAppearance.BAKE_INDICES.Length; iter++)
|
||||||
{
|
{
|
||||||
int j = AvatarAppearance.BAKE_INDICES[iter];
|
int j = AvatarAppearance.BAKE_INDICES[iter];
|
||||||
m_log.Debug("[UpdateBCache] {" + iter + "/" +
|
sp.Appearance.WearableCacheItems[j].TextureAsset = null;
|
||||||
sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
|
// m_log.Debug("[UpdateBCache] {" + iter + "/" +
|
||||||
sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
|
// sp.Appearance.WearableCacheItems[j].TextureIndex + "}: c-" +
|
||||||
sp.Appearance.WearableCacheItems[j].TextureID);
|
// sp.Appearance.WearableCacheItems[j].CacheId + ", t-" +
|
||||||
|
// sp.Appearance.WearableCacheItems[j].TextureID);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return (hits == cacheItems.Length);
|
return (hits == cacheItems.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +518,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
lock (m_setAppearanceLock)
|
lock (m_setAppearanceLock)
|
||||||
{
|
{
|
||||||
IAssetService cache = m_scene.AssetService;
|
IAssetCache cache = m_scene.RequestModuleInterface<IAssetCache>();
|
||||||
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
IBakedTextureModule bakedModule = m_scene.RequestModuleInterface<IBakedTextureModule>();
|
||||||
WearableCacheItem[] bakedModuleCache = null;
|
WearableCacheItem[] bakedModuleCache = null;
|
||||||
|
|
||||||
|
@ -553,6 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool wearableCacheValid = false;
|
bool wearableCacheValid = false;
|
||||||
if (wearableCache == null)
|
if (wearableCache == null)
|
||||||
{
|
{
|
||||||
|
@ -577,10 +583,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
hits++;
|
hits++;
|
||||||
wearableCache[idx].TextureAsset.Temporary = true;
|
wearableCache[idx].TextureAsset.Temporary = true;
|
||||||
wearableCache[idx].TextureAsset.Local = true;
|
wearableCache[idx].TextureAsset.Local = true;
|
||||||
cache.Store(wearableCache[idx].TextureAsset);
|
cache.Cache(wearableCache[idx].TextureAsset);
|
||||||
|
wearableCache[idx].TextureAsset = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cache.GetCached((wearableCache[idx].TextureID).ToString()) != null)
|
|
||||||
|
if (cache.Check((wearableCache[idx].TextureID).ToString()))
|
||||||
{
|
{
|
||||||
hits++;
|
hits++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -645,7 +653,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
|
wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
|
||||||
bakedModuleCache[i].TextureAsset.Temporary = true;
|
bakedModuleCache[i].TextureAsset.Temporary = true;
|
||||||
bakedModuleCache[i].TextureAsset.Local = true;
|
bakedModuleCache[i].TextureAsset.Local = true;
|
||||||
cache.Store(bakedModuleCache[i].TextureAsset);
|
cache.Cache(bakedModuleCache[i].TextureAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gotbacked = true;
|
gotbacked = true;
|
||||||
|
@ -677,6 +685,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
face.TextureID = wearableCache[idx].TextureID;
|
face.TextureID = wearableCache[idx].TextureID;
|
||||||
hits++;
|
hits++;
|
||||||
|
wearableCache[idx].TextureAsset = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -706,7 +715,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int texturesRebaked = 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++)
|
for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
|
||||||
{
|
{
|
||||||
|
@ -722,18 +731,12 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||||
|
|
||||||
if (missingTexturesOnly)
|
if (missingTexturesOnly)
|
||||||
{
|
{
|
||||||
if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
|
if (cache != null && cache.Check(face.TextureID.ToString()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
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(
|
m_log.DebugFormat(
|
||||||
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
|
"[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
|
||||||
face.TextureID, idx, sp.Name);
|
face.TextureID, idx, sp.Name);
|
||||||
|
|
|
@ -1839,12 +1839,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||||
webRequest.ContentType = "application/json-rpc";
|
webRequest.ContentType = "application/json-rpc";
|
||||||
webRequest.Method = "POST";
|
webRequest.Method = "POST";
|
||||||
|
|
||||||
using(Stream dataStream = webRequest.GetRequestStream())
|
|
||||||
dataStream.Write(content,0,content.Length);
|
|
||||||
|
|
||||||
WebResponse webResponse = null;
|
WebResponse webResponse = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using(Stream dataStream = webRequest.GetRequestStream())
|
||||||
|
dataStream.Write(content,0,content.Length);
|
||||||
|
|
||||||
webResponse = webRequest.GetResponse();
|
webResponse = webRequest.GetResponse();
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
|
@ -1920,12 +1920,12 @@ namespace OpenSim.Region.CoreModules.Avatar.UserProfiles
|
||||||
webRequest.ContentType = "application/json-rpc";
|
webRequest.ContentType = "application/json-rpc";
|
||||||
webRequest.Method = "POST";
|
webRequest.Method = "POST";
|
||||||
|
|
||||||
using(Stream dataStream = webRequest.GetRequestStream())
|
|
||||||
dataStream.Write(content,0,content.Length);
|
|
||||||
|
|
||||||
WebResponse webResponse = null;
|
WebResponse webResponse = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using(Stream dataStream = webRequest.GetRequestStream())
|
||||||
|
dataStream.Write(content,0,content.Length);
|
||||||
|
|
||||||
webResponse = webRequest.GetResponse();
|
webResponse = webRequest.GetResponse();
|
||||||
}
|
}
|
||||||
catch (WebException e)
|
catch (WebException e)
|
||||||
|
|
|
@ -142,9 +142,9 @@ namespace OpenSim.Region.CoreModules.Framework
|
||||||
|
|
||||||
if (capsObjectPath == oldCaps.CapsObjectPath)
|
if (capsObjectPath == oldCaps.CapsObjectPath)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat(
|
// m_log.WarnFormat(
|
||||||
"[CAPS]: Reusing caps for agent {0} in region {1}. Old caps path {2}, new caps path {3}. ",
|
// "[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);
|
// agentId, m_scene.RegionInfo.RegionName, oldCaps.CapsObjectPath, capsObjectPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
m_idCache = new ExpiringCache<ulong, DateTime>();
|
m_idCache = new ExpiringCache<ulong, DateTime>();
|
||||||
m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime));
|
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
|
// Remove the agent from the region's banned list
|
||||||
|
@ -417,12 +417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}",
|
"[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,
|
sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName,
|
||||||
e.Message, e.StackTrace);
|
e.Message, e.StackTrace);
|
||||||
|
if(sp != null && sp.ControllingClient != null && !sp.IsDeleted)
|
||||||
sp.ControllingClient.SendTeleportFailed("Internal error");
|
sp.ControllingClient.SendTeleportFailed("Internal error");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -1216,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR
|
// 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.
|
// IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS.
|
||||||
|
|
||||||
Thread.Sleep(15000);
|
Thread.Sleep(25000);
|
||||||
// if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
|
// if (m_eqModule != null && !sp.DoNotCloseAfterTeleport)
|
||||||
// m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
|
// m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID);
|
||||||
// Thread.Sleep(1000);
|
// Thread.Sleep(1000);
|
||||||
|
@ -1487,11 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
|
Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY));
|
||||||
|
|
||||||
if (neighbourRegion == null)
|
if (neighbourRegion == null)
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
|
||||||
if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
|
if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID))
|
||||||
{
|
{
|
||||||
|
failureReason = "Access Denied or Temporary not possible";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1510,6 +1511,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
// remember the fail
|
// remember the fail
|
||||||
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
|
||||||
|
if(String.IsNullOrWhiteSpace(failureReason))
|
||||||
|
failureReason = "Access Denied";
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1529,13 +1532,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState;
|
CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState;
|
||||||
ScenePresence agent = icon.EndInvoke(iar);
|
ScenePresence agent = icon.EndInvoke(iar);
|
||||||
|
|
||||||
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
|
|
||||||
|
|
||||||
if(!agent.IsChildAgent)
|
if(!agent.IsChildAgent)
|
||||||
{
|
{
|
||||||
// crossing failed
|
// crossing failed
|
||||||
agent.CrossToNewRegionFail();
|
agent.CrossToNewRegionFail();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname);
|
||||||
|
|
||||||
agent.IsInTransit = false;
|
agent.IsInTransit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2153,6 +2158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
|
Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
IPEndPoint ipe;
|
||||||
|
|
||||||
foreach (GridRegion neighbour in neighbours)
|
foreach (GridRegion neighbour in neighbours)
|
||||||
{
|
{
|
||||||
|
@ -2161,8 +2167,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
{
|
{
|
||||||
if (newneighbours.Contains(handler))
|
if (newneighbours.Contains(handler))
|
||||||
{
|
{
|
||||||
InformClientOfNeighbourAsync(sp, cagents[count], neighbour,
|
ipe = neighbour.ExternalEndPoint;
|
||||||
neighbour.ExternalEndPoint, true);
|
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++;
|
count++;
|
||||||
}
|
}
|
||||||
else if (!previousRegionNeighbourHandles.Contains(handler))
|
else if (!previousRegionNeighbourHandles.Contains(handler))
|
||||||
|
@ -2278,9 +2289,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
|
protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID,
|
||||||
double px, double py, uint pSizeHint)
|
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;
|
GridRegion ret = null;
|
||||||
const double fudge = 2.0;
|
|
||||||
|
|
||||||
if (m_notFoundLocationCache.Contains(px, py))
|
if (m_notFoundLocationCache.Contains(px, py))
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,7 @@ using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using OpenSim.Framework.Servers.HttpServer;
|
using OpenSim.Framework.Servers.HttpServer;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
@ -146,23 +147,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
|
||||||
}
|
}
|
||||||
|
|
||||||
IPAddress ia = null;
|
IPAddress ia = null;
|
||||||
try
|
ia = Util.GetHostFromDNS(ExternalHostNameForLSL);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ia == null)
|
if (ia == null)
|
||||||
{
|
{
|
||||||
m_ErrorStr = "Could not resolve ExternalHostNameForLSL, HTTP listener for LSL disabled";
|
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.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reflection;
|
|
||||||
using log4net;
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Server.Base;
|
using OpenSim.Services.Connectors;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
|
|
||||||
|
|
||||||
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
{
|
{
|
||||||
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalNeighbourServicesConnector")]
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NeighbourServicesOutConnector")]
|
||||||
public class LocalNeighbourServicesConnector :
|
public class NeighbourServicesOutConnector :
|
||||||
ISharedRegionModule, INeighbourService
|
NeighbourServicesConnector, ISharedRegionModule, INeighbourService
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(
|
LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private List<Scene> m_Scenes = new List<Scene>();
|
private List<Scene> m_Scenes = new List<Scene>();
|
||||||
|
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
public LocalNeighbourServicesConnector()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalNeighbourServicesConnector(List<Scene> scenes)
|
|
||||||
{
|
|
||||||
m_Scenes = scenes;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region ISharedRegionModule
|
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
{
|
{
|
||||||
get { return null; }
|
get { return null; }
|
||||||
|
@ -70,7 +58,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return "LocalNeighbourServicesConnector"; }
|
get { return "NeighbourServicesOutConnector"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialise(IConfigSource source)
|
public void Initialise(IConfigSource source)
|
||||||
|
@ -78,39 +66,32 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
IConfig moduleConfig = source.Configs["Modules"];
|
IConfig moduleConfig = source.Configs["Modules"];
|
||||||
if (moduleConfig != null)
|
if (moduleConfig != null)
|
||||||
{
|
{
|
||||||
string name = moduleConfig.GetString("NeighbourServices", this.Name);
|
string name = moduleConfig.GetString("NeighbourServices");
|
||||||
if (name == Name)
|
if (name == Name)
|
||||||
{
|
{
|
||||||
// m_Enabled rules whether this module registers as INeighbourService or not
|
|
||||||
m_Enabled = true;
|
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 Close()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene scene)
|
public void AddRegion(Scene scene)
|
||||||
{
|
{
|
||||||
m_Scenes.Add(scene);
|
|
||||||
|
|
||||||
if (!m_Enabled)
|
if (!m_Enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
m_Scenes.Add(scene);
|
||||||
scene.RegisterModuleInterface<INeighbourService>(this);
|
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)
|
public void RemoveRegion(Scene scene)
|
||||||
{
|
{
|
||||||
// Always remove
|
// Always remove
|
||||||
|
@ -118,28 +99,36 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour
|
||||||
m_Scenes.Remove(scene);
|
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
|
#region INeighbourService
|
||||||
|
|
||||||
public OpenSim.Services.Interfaces.GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
public override GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion)
|
||||||
{
|
{
|
||||||
uint x, y;
|
if (!m_Enabled)
|
||||||
Util.RegionHandleToRegionLoc(regionHandle, out x, out y);
|
return null;
|
||||||
|
|
||||||
foreach (Scene s in m_Scenes)
|
foreach (Scene s in m_Scenes)
|
||||||
{
|
{
|
||||||
if (s.RegionInfo.RegionHandle == regionHandle)
|
if (s.RegionInfo.RegionHandle == regionHandle)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[LOCAL NEIGHBOUR SERVICE CONNECTOR]: HelloNeighbour from region {0} to neighbour {1} at {2}-{3}",
|
// uint x, y;
|
||||||
thisRegion.RegionName, s.Name, 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}",
|
||||||
//m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour");
|
// thisRegion.RegionName, s.Name, x, y );
|
||||||
return s.IncomingHelloNeighbour(thisRegion);
|
return s.IncomingHelloNeighbour(thisRegion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle);
|
|
||||||
return null;
|
return base.HelloNeighbour(regionHandle, thisRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion INeighbourService
|
#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;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
|
||||||
|
@ -525,7 +526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public struct list
|
public class list
|
||||||
{
|
{
|
||||||
private object[] m_data;
|
private object[] m_data;
|
||||||
|
|
||||||
|
@ -1152,34 +1153,35 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public string ToCSV()
|
public string ToCSV()
|
||||||
{
|
{
|
||||||
string ret = "";
|
if(m_data == null || m_data.Length == 0)
|
||||||
foreach (object o in this.Data)
|
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 == "")
|
sb.Append(",");
|
||||||
{
|
sb.Append(o.ToString());
|
||||||
ret = o.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = ret + ", " + o.ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret;
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ToSoup()
|
private string ToSoup()
|
||||||
{
|
{
|
||||||
string output;
|
if(m_data == null || m_data.Length == 0)
|
||||||
output = String.Empty;
|
|
||||||
if (Data.Length == 0)
|
|
||||||
{
|
|
||||||
return String.Empty;
|
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)
|
public static explicit operator String(list l)
|
||||||
|
@ -1369,26 +1371,33 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
|
|
||||||
public string ToPrettyString()
|
public string ToPrettyString()
|
||||||
{
|
{
|
||||||
string output;
|
if(m_data == null || m_data.Length == 0)
|
||||||
if (Data.Length == 0)
|
|
||||||
{
|
|
||||||
return "[]";
|
return "[]";
|
||||||
}
|
|
||||||
output = "[";
|
StringBuilder sb = new StringBuilder(1024);
|
||||||
foreach (object o in Data)
|
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)
|
if (o is String)
|
||||||
{
|
{
|
||||||
output = output + "\"" + o + "\", ";
|
sb.Append("\"");
|
||||||
|
sb.Append((String)o);
|
||||||
|
sb.Append("\"");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output = output + o.ToString() + ", ";
|
sb.Append(o.ToString());
|
||||||
}
|
}
|
||||||
|
if(i < last)
|
||||||
|
sb.Append(",");
|
||||||
}
|
}
|
||||||
output = output.Substring(0, output.Length - 2);
|
sb.Append("]");
|
||||||
output = output + "]";
|
return sb.ToString();
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AlphaCompare : IComparer
|
public class AlphaCompare : IComparer
|
||||||
|
|
|
@ -82,8 +82,7 @@ namespace OpenSim.Server
|
||||||
ServicePointManager.UseNagleAlgorithm = false;
|
ServicePointManager.UseNagleAlgorithm = false;
|
||||||
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
|
ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
|
||||||
|
|
||||||
try { ServicePointManager.DnsRefreshTimeout = 120000; } // just is case some mono decides to have it infinity
|
try { ServicePointManager.DnsRefreshTimeout = 300000; } catch { }
|
||||||
catch { }
|
|
||||||
|
|
||||||
m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
|
m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid
|
||||||
{
|
{
|
||||||
Uri m_Uri = new Uri(m_ServerURL);
|
Uri m_Uri = new Uri(m_ServerURL);
|
||||||
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
IPAddress ip = Util.GetHostFromDNS(m_Uri.Host);
|
||||||
m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString());
|
if(ip != null)
|
||||||
if (!m_ServerURL.EndsWith("/"))
|
{
|
||||||
m_ServerURL += "/";
|
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)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,9 +295,6 @@ namespace OpenSim.Services.Connectors.Simulation
|
||||||
|
|
||||||
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
|
// 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
|
// Eventually, we want to use a caps url instead of the agentID
|
||||||
string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/";
|
string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/";
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
InventoryServices = "RemoteXInventoryServicesConnector"
|
InventoryServices = "RemoteXInventoryServicesConnector"
|
||||||
GridServices = "RemoteGridServicesConnector"
|
GridServices = "RemoteGridServicesConnector"
|
||||||
AvatarServices = "RemoteAvatarServicesConnector"
|
AvatarServices = "RemoteAvatarServicesConnector"
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||||
PresenceServices = "RemotePresenceServicesConnector"
|
PresenceServices = "RemotePresenceServicesConnector"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
InventoryServices = "HGInventoryBroker"
|
InventoryServices = "HGInventoryBroker"
|
||||||
GridServices = "RemoteGridServicesConnector"
|
GridServices = "RemoteGridServicesConnector"
|
||||||
AvatarServices = "RemoteAvatarServicesConnector"
|
AvatarServices = "RemoteAvatarServicesConnector"
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
AuthenticationServices = "RemoteAuthenticationServicesConnector"
|
||||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||||
PresenceServices = "RemotePresenceServicesConnector"
|
PresenceServices = "RemotePresenceServicesConnector"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
InventoryServices = "HGInventoryBroker"
|
InventoryServices = "HGInventoryBroker"
|
||||||
AvatarServices = "SimianAvatarServiceConnector"
|
AvatarServices = "SimianAvatarServiceConnector"
|
||||||
|
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
SimulationServices = "RemoteSimulationConnectorModule"
|
SimulationServices = "RemoteSimulationConnectorModule"
|
||||||
EntityTransferModule = "HGEntityTransferModule"
|
EntityTransferModule = "HGEntityTransferModule"
|
||||||
InventoryAccessModule = "HGInventoryAccessModule"
|
InventoryAccessModule = "HGInventoryAccessModule"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
InventoryServices = "SimianInventoryServiceConnector"
|
InventoryServices = "SimianInventoryServiceConnector"
|
||||||
AvatarServices = "SimianAvatarServiceConnector"
|
AvatarServices = "SimianAvatarServiceConnector"
|
||||||
|
|
||||||
NeighbourServices = "RemoteNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
SimulationServices = "RemoteSimulationConnectorModule"
|
SimulationServices = "RemoteSimulationConnectorModule"
|
||||||
EntityTransferModule = "BasicEntityTransferModule"
|
EntityTransferModule = "BasicEntityTransferModule"
|
||||||
InventoryAccessModule = "BasicInventoryAccessModule"
|
InventoryAccessModule = "BasicInventoryAccessModule"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
[Modules]
|
[Modules]
|
||||||
AssetServices = "LocalAssetServicesConnector"
|
AssetServices = "LocalAssetServicesConnector"
|
||||||
InventoryServices = "LocalInventoryServicesConnector"
|
InventoryServices = "LocalInventoryServicesConnector"
|
||||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||||
GridServices = "LocalGridServicesConnector"
|
GridServices = "LocalGridServicesConnector"
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
[Modules]
|
[Modules]
|
||||||
AssetServices = "HGAssetBroker"
|
AssetServices = "HGAssetBroker"
|
||||||
InventoryServices = "HGInventoryBroker"
|
InventoryServices = "HGInventoryBroker"
|
||||||
NeighbourServices = "LocalNeighbourServicesConnector"
|
NeighbourServices = "NeighbourServicesOutConnector"
|
||||||
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
AuthenticationServices = "LocalAuthenticationServicesConnector"
|
||||||
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
AuthorizationServices = "LocalAuthorizationServicesConnector"
|
||||||
GridServices = "LocalGridServicesConnector"
|
GridServices = "LocalGridServicesConnector"
|
||||||
|
|
Loading…
Reference in New Issue