mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 17:32:42 +08:00
a few more useless changes
This commit is contained in:
@@ -185,11 +185,8 @@ namespace OpenSim.Framework
|
||||
|
||||
public void RemoveItem(UUID itemID)
|
||||
{
|
||||
if (m_items.ContainsKey(itemID))
|
||||
{
|
||||
m_ids.Remove(itemID);
|
||||
m_items.Remove(itemID);
|
||||
}
|
||||
m_ids.Remove(itemID);
|
||||
m_items.Remove(itemID);
|
||||
}
|
||||
|
||||
public void RemoveAsset(UUID assetID)
|
||||
@@ -225,9 +222,7 @@ namespace OpenSim.Framework
|
||||
|
||||
public UUID GetAsset(UUID itemID)
|
||||
{
|
||||
if (!m_items.ContainsKey(itemID))
|
||||
return UUID.Zero;
|
||||
return m_items[itemID];
|
||||
return m_items.TryGetValue(itemID, out UUID id) ? id : UUID.Zero;
|
||||
}
|
||||
|
||||
public static AvatarWearable[] DefaultWearables
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenSim.Framework
|
||||
public bool IsBlocked(string key)
|
||||
{
|
||||
bool ret = false;
|
||||
_blockLockSlim.EnterReadLock();
|
||||
_blockLockSlim.EnterReadLock();
|
||||
ret = _tempBlocked.ContainsKey(key);
|
||||
_blockLockSlim.ExitReadLock();
|
||||
return ret;
|
||||
@@ -140,11 +140,8 @@ namespace OpenSim.Framework
|
||||
|
||||
if (_options.MaxConcurrentSessions > 0)
|
||||
{
|
||||
int sessionscount = 0;
|
||||
|
||||
_sessionLockSlim.EnterReadLock();
|
||||
if (_sessions.ContainsKey(key))
|
||||
sessionscount = _sessions[key];
|
||||
_sessions.TryGetValue(key, out int sessionscount);
|
||||
_sessionLockSlim.ExitReadLock();
|
||||
|
||||
if (sessionscount > _options.MaxConcurrentSessions)
|
||||
|
||||
@@ -344,26 +344,20 @@ namespace OpenSim.Framework
|
||||
//
|
||||
protected virtual CacheItemBase GetItem(string index)
|
||||
{
|
||||
CacheItemBase item = null;
|
||||
|
||||
lock (m_Index)
|
||||
{
|
||||
if (m_Lookup.ContainsKey(index))
|
||||
item = m_Lookup[index];
|
||||
|
||||
if (item == null)
|
||||
if(m_Lookup.TryGetValue(index, out CacheItemBase item))
|
||||
{
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.UtcNow;
|
||||
Expire(true);
|
||||
return null;
|
||||
return item;
|
||||
}
|
||||
|
||||
item.hits++;
|
||||
item.lastUsed = DateTime.UtcNow;
|
||||
|
||||
Expire(true);
|
||||
return null;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
// Get an item from cache. Do not try to fetch from source if not
|
||||
@@ -566,12 +560,9 @@ namespace OpenSim.Framework
|
||||
{
|
||||
lock (m_Index)
|
||||
{
|
||||
if (!m_Lookup.ContainsKey(uuid))
|
||||
return;
|
||||
|
||||
CacheItemBase item = m_Lookup[uuid];
|
||||
if (m_Lookup.TryGetValue(uuid, out CacheItemBase item))
|
||||
m_Index.Remove(item);
|
||||
m_Lookup.Remove(uuid);
|
||||
m_Index.Remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,18 +269,13 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
lock (m_threads)
|
||||
{
|
||||
if (m_threads.ContainsKey(threadID))
|
||||
if(RemoveThread(threadID))
|
||||
{
|
||||
//ThreadWatchdogInfo twi = m_threads[threadID];
|
||||
//twi.Thread.Abort();
|
||||
RemoveThread(threadID);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,11 +320,8 @@ namespace OpenSim.Framework.Monitoring
|
||||
{
|
||||
lock (m_threads)
|
||||
{
|
||||
if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId))
|
||||
return m_threads[Thread.CurrentThread.ManagedThreadId];
|
||||
return m_threads.TryGetValue(Thread.CurrentThread.ManagedThreadId, out ThreadWatchdogInfo twi) ? twi : null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -159,17 +159,13 @@ namespace OpenSim.Framework
|
||||
{
|
||||
log.Info("[PLUGINS]: Loading extension point " + ext);
|
||||
|
||||
if (constraints.ContainsKey(ext))
|
||||
if (constraints.TryGetValue(ext , out IPluginConstraint cons))
|
||||
{
|
||||
IPluginConstraint cons = constraints[ext];
|
||||
if (cons.Apply(ext))
|
||||
log.Error("[PLUGINS]: " + ext + " failed constraint: " + cons.Message);
|
||||
}
|
||||
|
||||
IPluginFilter filter = null;
|
||||
|
||||
if (filters.ContainsKey(ext))
|
||||
filter = filters[ext];
|
||||
filters.TryGetValue(ext, out IPluginFilter filter);
|
||||
|
||||
List<T> loadedPlugins = new List<T>();
|
||||
foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes(ext))
|
||||
|
||||
@@ -1139,12 +1139,13 @@ namespace OpenSim.Framework
|
||||
UInt32.TryParse(args["region_yloc"].AsString(), out locy);
|
||||
RegionLocY = locy;
|
||||
}
|
||||
if (args.ContainsKey("region_size_x"))
|
||||
RegionSizeX = (uint)args["region_size_x"].AsInteger();
|
||||
if (args.ContainsKey("region_size_y"))
|
||||
RegionSizeY = (uint)args["region_size_y"].AsInteger();
|
||||
if (args.ContainsKey("region_size_z"))
|
||||
RegionSizeZ = (uint)args["region_size_z"].AsInteger();
|
||||
OSD osdtmp;
|
||||
if (args.TryGetValue("region_size_x", out osdtmp))
|
||||
RegionSizeX = (uint)osdtmp.AsInteger();
|
||||
if (args.TryGetValue("region_size_y", out osdtmp))
|
||||
RegionSizeY = (uint)osdtmp.AsInteger();
|
||||
if (args.TryGetValue("region_size_z", out osdtmp))
|
||||
RegionSizeZ = (uint)osdtmp.AsInteger();
|
||||
|
||||
IPAddress ip_addr = null;
|
||||
if (args["internal_ep_address"] != null)
|
||||
|
||||
@@ -53,9 +53,9 @@ namespace OpenSim.Framework
|
||||
|
||||
public bool TryGet<T>(out T iface)
|
||||
{
|
||||
if (m_moduleInterfaces.ContainsKey(typeof(T)))
|
||||
if (m_moduleInterfaces.TryGetValue(typeof(T), out object o))
|
||||
{
|
||||
iface = (T)m_moduleInterfaces[typeof(T)];
|
||||
iface = (T)o;
|
||||
return true;
|
||||
}
|
||||
iface = default(T);
|
||||
|
||||
Reference in New Issue
Block a user