diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 80b83069e2..48274c1ae5 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs @@ -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; } /// @@ -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); } - - /// /// Handle raw uploaded baked texture data. /// diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs index 10ea8eefe6..fd484bad8e 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureServerConnector.cs @@ -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")); diff --git a/OpenSim/Framework/RestClient.cs b/OpenSim/Framework/RestClient.cs index 0166d9d37e..4939cf7bfd 100644 --- a/OpenSim/Framework/RestClient.cs +++ b/OpenSim/Framework/RestClient.cs @@ -428,22 +428,23 @@ namespace OpenSim.Framework if (WebUtil.DebugLevel >= 5) 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 { + 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(); } catch (WebException e) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index ffc6ad3fee..415c2643b0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -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; diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs index f627ae61ee..3bb2313023 100644 --- a/OpenSim/Framework/Servers/ServerBase.cs +++ b/OpenSim/Framework/Servers/ServerBase.cs @@ -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 ", @@ -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> calls = Util.GetFireAndForgetCallsInProgress().ToList(); diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 83d9df19bb..f52a84c2e0 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -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 dnscache = new ExpiringCache(); + /// /// Converts a URL to a IPAddress /// @@ -1066,38 +1010,128 @@ namespace OpenSim.Framework /// An IP address, or null 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; + return null; } - 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) - return hosts[0]; + if(ia != null) + dnscache.AddOrUpdate(hostname, ia, 300); - return null; + return getEndPoint(ia,port); } public static Uri GetURI(string protocol, string hostname, int port, string path) diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 12f58feb79..7b085d0ac1 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -71,11 +71,6 @@ namespace OpenSim.Framework /// public static int RequestNumber { get; set; } - /// - /// Control where OSD requests should be serialized per endpoint. - /// - public static bool SerializeOSDRequestsPerEndpoint { get; set; } - /// /// this is the header field used to communicate the local request id /// used for performance and debugging @@ -98,31 +93,6 @@ namespace OpenSim.Framework /// public const int MaxRequestDiagLength = 200; - /// - /// Dictionary of end points - /// - private static Dictionary m_endpointSerializer = new Dictionary(); - - 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 /// @@ -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"; diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 447afb4654..66ce8e5e3d 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -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; diff --git a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs index dfe097ef97..b406b3743a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/UploadBakedTextureModule.cs @@ -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(); - - - // 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", diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 535d946710..9553f5b4b8 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -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(); IBakedTextureModule m_BakedTextureModule = m_scene.RequestModuleInterface(); int validDirtyBakes = 0; @@ -385,7 +385,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory List missing = new List(); - 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(); IBakedTextureModule bakedModule = m_scene.RequestModuleInterface(); 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 cache = m_scene.RequestModuleInterface(); 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); diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs index 89e30206f1..e02ca497ed 100644 --- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs @@ -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) diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 292099d864..c0afe7c49d 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs @@ -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 diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index ca2060439a..a1ada4c3a6 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer m_idCache = new ExpiringCache(); m_bannedRegions.Add(pAgentID, m_idCache, TimeSpan.FromSeconds(newTime)); } - m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), TimeSpan.FromSeconds(extendTime)); + m_idCache.Add(pRegionHandle, DateTime.UtcNow + TimeSpan.FromSeconds(extendTime), extendTime); } // Remove the agent from the region's banned list @@ -417,12 +417,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } catch (Exception e) { + m_log.ErrorFormat( "[ENTITY TRANSFER MODULE]: Exception on teleport of {0} from {1}@{2} to {3}@{4}: {5}{6}", sp.Name, sp.AbsolutePosition, sp.Scene.RegionInfo.RegionName, position, destinationRegionName, e.Message, e.StackTrace); - - sp.ControllingClient.SendTeleportFailed("Internal error"); + if(sp != null && sp.ControllingClient != null && !sp.IsDeleted) + sp.ControllingClient.SendTeleportFailed("Internal error"); } finally { @@ -1216,7 +1217,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // DECREASING THE WAIT TIME HERE WILL EITHER RESULT IN A VIEWER CRASH OR // IN THE AVIE BEING PLACED IN INFINITY FOR A COUPLE OF SECONDS. - Thread.Sleep(15000); + Thread.Sleep(25000); // if (m_eqModule != null && !sp.DoNotCloseAfterTeleport) // m_eqModule.DisableSimulator(sourceRegionHandle,sp.UUID); // Thread.Sleep(1000); @@ -1487,11 +1488,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer Math.Max(scene.RegionInfo.RegionSizeX, scene.RegionInfo.RegionSizeY)); if (neighbourRegion == null) - { return null; - } + if (m_bannedRegionCache.IfBanned(neighbourRegion.RegionHandle, agentID)) { + failureReason = "Access Denied or Temporary not possible"; return null; } @@ -1503,13 +1504,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer pos.Z); string homeURI = scene.GetAgentHomeURI(agentID); - + if (!scene.SimulationService.QueryAccess( neighbourRegion, agentID, homeURI, false, newpos, scene.GetFormatsOffered(), ctx, out failureReason)) { // remember the fail m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); + if(String.IsNullOrWhiteSpace(failureReason)) + failureReason = "Access Denied"; return null; } @@ -1529,13 +1532,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer CrossAsyncDelegate icon = (CrossAsyncDelegate)iar.AsyncState; ScenePresence agent = icon.EndInvoke(iar); - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); if(!agent.IsChildAgent) { // crossing failed agent.CrossToNewRegionFail(); } + else + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Crossing agent {0} {1} completed.", agent.Firstname, agent.Lastname); + agent.IsInTransit = false; } @@ -2153,6 +2158,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { Thread.Sleep(200); // the original delay that was at InformClientOfNeighbourAsync start int count = 0; + IPEndPoint ipe; foreach (GridRegion neighbour in neighbours) { @@ -2161,8 +2167,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { if (newneighbours.Contains(handler)) { - InformClientOfNeighbourAsync(sp, cagents[count], neighbour, - neighbour.ExternalEndPoint, true); + ipe = neighbour.ExternalEndPoint; + if (ipe != null) + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, ipe, true); + else + { + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: lost DNS resolution for neighbour {0}", neighbour.ExternalHostName); + } count++; } else if (!previousRegionNeighbourHandles.Contains(handler)) @@ -2278,9 +2289,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected GridRegion GetRegionContainingWorldLocation(IGridService pGridService, UUID pScopeID, double px, double py, uint pSizeHint) { - m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); +// m_log.DebugFormat("{0} GetRegionContainingWorldLocation: call, XY=<{1},{2}>", LogHeader, px, py); GridRegion ret = null; - const double fudge = 2.0; if (m_notFoundLocationCache.Contains(px, py)) { diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 66ebdbe65f..5f72733488 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -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"; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs similarity index 72% rename from OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs rename to OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs index e8d01b01c1..60addec12c 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/NeighbourServiceOutConnector.cs @@ -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 m_Scenes = new List(); - private bool m_Enabled = false; - public LocalNeighbourServicesConnector() - { - } - - public LocalNeighbourServicesConnector(List 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(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 diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs deleted file mode 100644 index fcb55216ec..0000000000 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/RemoteNeighourServiceConnector.cs +++ /dev/null @@ -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 m_Scenes = new List(); - - 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(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(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 - } -} diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index f16fd0146b..4d7a6988bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -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(); - } - else - { - ret = ret + ", " + o.ToString(); - } + sb.Append(","); + sb.Append(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 diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 5c99ab7b8b..4b7fd8a087 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs @@ -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); diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index b261675572..f2bb52aa4d 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -70,9 +70,14 @@ namespace OpenSim.Services.Connectors.Hypergrid { Uri m_Uri = new Uri(m_ServerURL); IPAddress ip = Util.GetHostFromDNS(m_Uri.Host); - m_ServerURL = m_ServerURL.Replace(m_Uri.Host, ip.ToString()); - if (!m_ServerURL.EndsWith("/")) - m_ServerURL += "/"; + 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) { diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 9f4d89ab6f..a4ca2d3ecb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -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() + "/"; diff --git a/bin/config-include/Grid.ini b/bin/config-include/Grid.ini index fc988792b4..988e681a00 100644 --- a/bin/config-include/Grid.ini +++ b/bin/config-include/Grid.ini @@ -12,7 +12,7 @@ InventoryServices = "RemoteXInventoryServicesConnector" GridServices = "RemoteGridServicesConnector" AvatarServices = "RemoteAvatarServicesConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" PresenceServices = "RemotePresenceServicesConnector" diff --git a/bin/config-include/GridHypergrid.ini b/bin/config-include/GridHypergrid.ini index f5f4c8755f..68f2eb1d41 100644 --- a/bin/config-include/GridHypergrid.ini +++ b/bin/config-include/GridHypergrid.ini @@ -15,7 +15,7 @@ InventoryServices = "HGInventoryBroker" GridServices = "RemoteGridServicesConnector" AvatarServices = "RemoteAvatarServicesConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "RemoteAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" PresenceServices = "RemotePresenceServicesConnector" diff --git a/bin/config-include/HyperSimianGrid.ini b/bin/config-include/HyperSimianGrid.ini index efad5772a3..018c65e92c 100644 --- a/bin/config-include/HyperSimianGrid.ini +++ b/bin/config-include/HyperSimianGrid.ini @@ -29,7 +29,7 @@ InventoryServices = "HGInventoryBroker" AvatarServices = "SimianAvatarServiceConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" SimulationServices = "RemoteSimulationConnectorModule" EntityTransferModule = "HGEntityTransferModule" InventoryAccessModule = "HGInventoryAccessModule" diff --git a/bin/config-include/SimianGrid.ini b/bin/config-include/SimianGrid.ini index 5749656231..b3db08a598 100644 --- a/bin/config-include/SimianGrid.ini +++ b/bin/config-include/SimianGrid.ini @@ -29,7 +29,7 @@ InventoryServices = "SimianInventoryServiceConnector" AvatarServices = "SimianAvatarServiceConnector" - NeighbourServices = "RemoteNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" SimulationServices = "RemoteSimulationConnectorModule" EntityTransferModule = "BasicEntityTransferModule" InventoryAccessModule = "BasicInventoryAccessModule" diff --git a/bin/config-include/Standalone.ini b/bin/config-include/Standalone.ini index 78ada2b7c3..db7cb365cd 100644 --- a/bin/config-include/Standalone.ini +++ b/bin/config-include/Standalone.ini @@ -7,7 +7,7 @@ [Modules] AssetServices = "LocalAssetServicesConnector" InventoryServices = "LocalInventoryServicesConnector" - NeighbourServices = "LocalNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "LocalAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" GridServices = "LocalGridServicesConnector" diff --git a/bin/config-include/StandaloneHypergrid.ini b/bin/config-include/StandaloneHypergrid.ini index eaacfff36a..84867a9a3c 100644 --- a/bin/config-include/StandaloneHypergrid.ini +++ b/bin/config-include/StandaloneHypergrid.ini @@ -10,7 +10,7 @@ [Modules] AssetServices = "HGAssetBroker" InventoryServices = "HGInventoryBroker" - NeighbourServices = "LocalNeighbourServicesConnector" + NeighbourServices = "NeighbourServicesOutConnector" AuthenticationServices = "LocalAuthenticationServicesConnector" AuthorizationServices = "LocalAuthorizationServicesConnector" GridServices = "LocalGridServicesConnector"