* 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:
John Hurliman
2008-12-15 21:05:50 +00:00
parent 4e791ad340
commit 94ea54bed6
2 changed files with 50 additions and 4 deletions

View File

@@ -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)