mirror of
https://github.com/opensim/opensim.git
synced 2026-06-19 20:05:47 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecdcaca032 | ||
|
|
2720a1db36 |
@@ -916,18 +916,17 @@ namespace OpenSim.Framework
|
||||
{
|
||||
// Wearables
|
||||
OSD tmpOSD8;
|
||||
OSDArray wears8 = null;
|
||||
int wears8Count = 0;
|
||||
|
||||
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray))
|
||||
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray wears8))
|
||||
{
|
||||
wears8 = (OSDArray)tmpOSD8;
|
||||
wears8Count = wears8.Count;
|
||||
}
|
||||
else
|
||||
wears8 = null;
|
||||
|
||||
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray wears))
|
||||
{
|
||||
OSDArray wears = (OSDArray)tmpOSD;
|
||||
if(wears.Count + wears8Count > 0)
|
||||
{
|
||||
m_wearables = new AvatarWearable[wears.Count + wears8Count];
|
||||
@@ -948,9 +947,8 @@ namespace OpenSim.Framework
|
||||
Primitive.TextureEntry te = new Primitive.TextureEntry(teb, 0, teb.Length);
|
||||
m_texture = te;
|
||||
}
|
||||
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray textures))
|
||||
{
|
||||
OSDArray textures = (OSDArray)tmpOSD;
|
||||
for (int i = 0; i < textures.Count && i < TEXTURE_COUNT_PV7; ++i)
|
||||
{
|
||||
tmpOSD = textures[i];
|
||||
@@ -959,26 +957,12 @@ namespace OpenSim.Framework
|
||||
}
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray bakedOSDArray))
|
||||
{
|
||||
OSDArray bakedOSDArray = (OSDArray)tmpOSD;
|
||||
m_cacheitems = WearableCacheItem.GetDefaultCacheItem();
|
||||
|
||||
bakedOSDArray = (OSDArray)tmpOSD;
|
||||
foreach (OSDMap item in bakedOSDArray)
|
||||
foreach (OSD oitem in bakedOSDArray)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
continue;
|
||||
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
|
||||
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
{
|
||||
bakedOSDArray = (OSDArray)tmpOSD;
|
||||
foreach (OSDMap item in bakedOSDArray)
|
||||
if(oitem is OSDMap item)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
@@ -988,6 +972,22 @@ namespace OpenSim.Framework
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
|
||||
{
|
||||
foreach (OSD oitem in bakedOSDArray)
|
||||
{
|
||||
if(oitem is OSDMap item)
|
||||
{
|
||||
int idx = item["textureindex"].AsInteger();
|
||||
if (idx < 0 || idx >= m_cacheitems.Length)
|
||||
continue;
|
||||
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
|
||||
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
|
||||
m_cacheitems[idx].TextureAsset = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Visual Parameters
|
||||
@@ -1002,9 +1002,8 @@ namespace OpenSim.Framework
|
||||
}
|
||||
|
||||
// Attachments
|
||||
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
|
||||
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray attachs)
|
||||
{
|
||||
OSDArray attachs = (OSDArray)tmpOSD;
|
||||
for (int i = 0; i < attachs.Count; i++)
|
||||
{
|
||||
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);
|
||||
|
||||
@@ -81,8 +81,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public Lazy(Func<T> valueFactory, LazyThreadSafetyMode mode)
|
||||
{
|
||||
if (valueFactory == null)
|
||||
throw new ArgumentNullException("valueFactory");
|
||||
ArgumentNullException.ThrowIfNull(valueFactory);
|
||||
this.factory = valueFactory;
|
||||
if (mode != LazyThreadSafetyMode.None)
|
||||
monitor = new object();
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
set { m_certificateValidationCallback = value; }
|
||||
}
|
||||
private static readonly char[] LineSeparators = ['\n','\r'];
|
||||
|
||||
private void load_cert(string CPath, string CPass)
|
||||
{
|
||||
@@ -223,13 +224,13 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
AsnEncodedData asndata = new AsnEncodedData(ext.Oid, ext.RawData);
|
||||
string datastr = asndata.Format(true);
|
||||
string[] lines = datastr.Split(new char[] {'\n','\r'});
|
||||
string[] lines = datastr.Split(LineSeparators);
|
||||
foreach(string s in lines)
|
||||
{
|
||||
if(String.IsNullOrEmpty(s))
|
||||
if(string.IsNullOrEmpty(s))
|
||||
continue;
|
||||
string[] parts = s.Split(new char[] {'='});
|
||||
if(String.IsNullOrEmpty(parts[0]))
|
||||
string[] parts = s.Split('=');
|
||||
if(string.IsNullOrEmpty(parts[0]))
|
||||
continue;
|
||||
string entryName = parts[0].Replace(" ","");
|
||||
if(entryName == "DNSName")
|
||||
@@ -1015,8 +1016,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (innerStream != null)
|
||||
innerStream.Dispose();
|
||||
innerStream?.Dispose();
|
||||
inputStream.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OSHttpServer
|
||||
public RequestCookie(string id, string content)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
|
||||
if (content == null) throw new ArgumentNullException("content");
|
||||
ArgumentNullException.ThrowIfNull(content);
|
||||
|
||||
_name = id;
|
||||
_value = content;
|
||||
|
||||
@@ -79,8 +79,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
XmlWriterSettings settings = new()
|
||||
{
|
||||
Encoding = Encoding.UTF8
|
||||
};
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
@@ -134,8 +136,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
using (MemoryStream buffer = new MemoryStream())
|
||||
{
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
settings.Encoding = Encoding.UTF8;
|
||||
XmlWriterSettings settings = new() { Encoding = Encoding.UTF8 };
|
||||
|
||||
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
|
||||
{
|
||||
@@ -169,8 +170,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
|
||||
|
||||
deserial = (TResponse)deserializer.Deserialize(stream);
|
||||
if (stream != null)
|
||||
stream.Close();
|
||||
stream?.Close();
|
||||
|
||||
if (deserial != null && ResponseCallback != null)
|
||||
{
|
||||
|
||||
@@ -1009,8 +1009,7 @@ namespace OpenSim.Framework
|
||||
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);
|
||||
|
||||
if (auth != null)
|
||||
auth.AddAuthorization(request.Headers);
|
||||
auth?.AddAuthorization(request.Headers);
|
||||
|
||||
request.AllowWriteStreamBuffering = false;
|
||||
|
||||
|
||||
@@ -1535,10 +1535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
catch (Exception ex)
|
||||
{
|
||||
m_log.Error($"Packet statistics gathering failed: {ex.Message}");
|
||||
if (PacketLog.Log != null)
|
||||
{
|
||||
PacketLog.Log.Close();
|
||||
}
|
||||
PacketLog?.Log?.Close();
|
||||
PacketLog = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,8 +226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
m_parent?.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -246,8 +245,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
}
|
||||
|
||||
// Pass the new values up to the parent
|
||||
if (Parent != null)
|
||||
Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
Parent?.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -351,8 +349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
{
|
||||
m_dripRate = Math.Clamp(value, m_minimumFlow, MaxDripRate);
|
||||
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, m_dripRate);
|
||||
m_parent?.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -371,8 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
m_dripRate = m_maxDripRate * .5f;
|
||||
else
|
||||
m_dripRate = m_maxDripRate;
|
||||
if (m_parent != null)
|
||||
m_parent.RegisterRequest(this, m_dripRate);
|
||||
m_parent?.RegisterRequest(this, m_dripRate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -392,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||
public void AcknowledgePackets(Int32 count)
|
||||
{
|
||||
if (m_enabled)
|
||||
AdjustedDripRate = AdjustedDripRate + count;
|
||||
AdjustedDripRate += count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
private object m_setAppearanceLock = new object();
|
||||
|
||||
// add throttle
|
||||
private ConcurrentDictionary<string, long> m_rebakeThrottle = new ConcurrentDictionary<string, long>();
|
||||
private const int REBAKE_THROTTLE_SECONDS = 30;
|
||||
readonly ExpiringKey<string> m_rebakeThrottle = new(500 * REBAKE_THROTTLE_SECONDS);
|
||||
|
||||
#region Region Module interface
|
||||
|
||||
@@ -456,28 +456,17 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
sp.Appearance.WearableCacheItems = wearableCache;
|
||||
|
||||
// throttle rebake requests
|
||||
|
||||
if (missing.Count > 0)
|
||||
{
|
||||
long now = DateTime.UtcNow.Ticks;
|
||||
|
||||
string spuuidstr = sp.UUID.ToString();
|
||||
foreach (UUID id in missing)
|
||||
{
|
||||
string key = sp.UUID.ToString() + ":" + id.ToString();
|
||||
string key = spuuidstr + id.ToString();
|
||||
|
||||
long last;
|
||||
if (m_rebakeThrottle.TryGetValue(key, out last))
|
||||
{
|
||||
TimeSpan age = new TimeSpan(now - last);
|
||||
if (age.TotalSeconds < REBAKE_THROTTLE_SECONDS)
|
||||
continue;
|
||||
}
|
||||
if(m_rebakeThrottle.AddOrUpdate(key, 1000 * REBAKE_THROTTLE_SECONDS))
|
||||
continue;
|
||||
|
||||
m_rebakeThrottle[key] = now;
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[AVFACTORY]: Missing baked texture {0} for {1}, requesting rebake",
|
||||
id, sp.Name);
|
||||
m_log.Debug($"[AVFACTORY]: Missing baked texture {id} for {sp.Name}, requesting rebake");
|
||||
|
||||
sp.ControllingClient.SendRebakeAvatarTextures(id);
|
||||
}
|
||||
|
||||
@@ -105,11 +105,9 @@ namespace OpenSim.Region.CoreModules
|
||||
}
|
||||
|
||||
// Check for desired plugin
|
||||
if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
|
||||
if (m_availableWindPlugins.TryGetValue(m_dWindPluginName, out m_activeWindPlugin))
|
||||
{
|
||||
m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
|
||||
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
|
||||
|
||||
if (m_windConfig != null)
|
||||
{
|
||||
|
||||
@@ -123,8 +123,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if(m_odeScene != null)
|
||||
m_odeScene.RegionLoaded();
|
||||
m_odeScene?.RegionLoaded();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1331,8 +1331,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(stream != null)
|
||||
stream.Dispose();
|
||||
stream?.Dispose();
|
||||
}
|
||||
|
||||
if (!ok && File.Exists(filename))
|
||||
|
||||
@@ -61,8 +61,7 @@ namespace OpenSim.Services.AssetService
|
||||
if (assetConfig == null)
|
||||
throw new Exception("No " + m_ConfigName + " configuration");
|
||||
|
||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
|
||||
String.Empty);
|
||||
string loaderArgs = assetConfig.GetString("AssetLoaderArgs", string.Empty);
|
||||
|
||||
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
|
||||
|
||||
@@ -92,11 +91,8 @@ namespace OpenSim.Services.AssetService
|
||||
|
||||
public virtual AssetBase Get(string id)
|
||||
{
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(id, out assetID))
|
||||
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
|
||||
if (!UUID.TryParse(id, out UUID assetID))
|
||||
{
|
||||
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested asset id {0}", id);
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user