protected void RemWatcher(IActorRef watchee, IActorRef watcher)
{
var watcheeSelf = watchee.Equals(Self);
var watcherSelf = watcher.Equals(Self);
if (watcheeSelf && !watcherSelf)
{
if (_state.ContainsWatchedBy(watcher)) MaintainAddressTerminatedSubscription(() =>
{
_state = _state.RemoveWatchedBy(watcher);
if (System.Settings.DebugLifecycle) Publish(new Debug(Self.Path.ToString(), Actor.GetType(), string.Format("no longer watched by {0}", watcher)));
}, watcher);
}
else if (!watcheeSelf && watcherSelf)
{
Unwatch(watchee);
}
else
{
Publish(new Warning(Self.Path.ToString(), Actor.GetType(), string.Format("BUG: illegal Unwatch({0},{1} for {2}", watchee, watcher, Self)));
}
}