redundant unsubscribing should be fine
This commit is contained in:
parent
5dde912564
commit
21c7e4d050
@ -138,15 +138,23 @@ namespace franz
|
||||
_TelefranzConsumers<T>.wrappings[theAction] = wrapped;
|
||||
topicSubscribers[topic]++;
|
||||
}
|
||||
public void removeHandler<T>(Action<T> theAction) where T : silver_messages.message
|
||||
public bool removeHandler<T>(Action<T> theAction) where T : silver_messages.message
|
||||
{
|
||||
topicConsumers[typeof(T).ToString()].MessageReceived -= _TelefranzConsumers<T>.wrappings[theAction];
|
||||
if (_TelefranzConsumers<T>.wrappings.ContainsKey(theAction))
|
||||
{
|
||||
_TelefranzConsumers<T>.wrappings.Remove(theAction);
|
||||
topicSubscribers[typeof(T).ToString()]--;
|
||||
if (topicSubscribers[typeof(T).ToString()] == 0)
|
||||
{
|
||||
topicConsumers[typeof(T).ToString()].StopConsume();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void ProduceMessage<T>(T message) where T : silver_messages.message
|
||||
|
Loading…
Reference in New Issue
Block a user