* Changed EventQueueServer to always obey the KeepAlive setting requested by the client
* Added (very slow, O(n)) DoubleDictionary.Remove(TKey1) and DoubleDictionary.Remove(TKey2) functions git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2381 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -76,6 +76,52 @@ namespace OpenMetaverse
|
||||
}
|
||||
}
|
||||
|
||||
public bool Remove(TKey1 key1)
|
||||
{
|
||||
// This is an O(n) operation!
|
||||
lock (syncObject)
|
||||
{
|
||||
TValue value;
|
||||
if (Dictionary1.TryGetValue(key1, out value))
|
||||
{
|
||||
foreach (KeyValuePair<TKey2, TValue> kvp in Dictionary2)
|
||||
{
|
||||
if (kvp.Value.Equals(value))
|
||||
{
|
||||
Dictionary1.Remove(key1);
|
||||
Dictionary2.Remove(kvp.Key);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Remove(TKey2 key2)
|
||||
{
|
||||
// This is an O(n) operation!
|
||||
lock (syncObject)
|
||||
{
|
||||
TValue value;
|
||||
if (Dictionary2.TryGetValue(key2, out value))
|
||||
{
|
||||
foreach (KeyValuePair<TKey1, TValue> kvp in Dictionary1)
|
||||
{
|
||||
if (kvp.Value.Equals(value))
|
||||
{
|
||||
Dictionary2.Remove(key2);
|
||||
Dictionary1.Remove(kvp.Key);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (syncObject)
|
||||
|
||||
Reference in New Issue
Block a user