Skip to content

Commit

Permalink
cleaned up referential equality inside RemoteWatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Mar 11, 2016
1 parent dbd1667 commit 1ea39bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/core/Akka.Remote/RemoteWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,13 +427,13 @@ private void AddWatching(IActorRef watchee, IActorRef watcher)

protected void ProcessUnwatchRemote(IActorRef watchee, IActorRef watcher)
{
if (watcher != Self)
if (!Equals(watcher, Self))
{
_log.Debug("Unwatching: [{0} -> {1}]", watcher.Path, watchee.Path);
_watching.Remove(Tuple.Create(watchee, watcher));

// clean up self watch when no more watchers of this watchee
if (_watching.All(t => t.Item1 != watchee || t.Item2 == Self))
if (_watching.All(t => !Equals(t.Item1, watchee) || Equals(t.Item2, Self)))
{
_log.Debug("Cleanup self watch of [{0}]", watchee.Path);
Context.Unwatch(watchee);
Expand All @@ -456,7 +456,7 @@ private void ProcessTerminated(IActorRef watchee, bool existenceConfirmed, bool
var toProcess = _watching.Where(t => t.Item1.Equals(watchee)).ToList();
foreach (var t in toProcess)
{
if (!addressTerminated && t.Item2 != Self)
if (!addressTerminated && !Equals(t.Item2, Self))
t.Item2.Tell(new DeathWatchNotification(watchee, existenceConfirmed, false));
}

Expand Down
8 changes: 2 additions & 6 deletions src/core/Akka.Remote/Transport/ThrottleTransportAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,13 @@ public override Task<bool> ManagementCommand(object message)
{
return r.Result is SetThrottleAck;
},
TaskContinuationOptions.AttachedToParent |
TaskContinuationOptions.ExecuteSynchronously |
TaskContinuationOptions.OnlyOnRanToCompletion);
TaskContinuationOptions.ExecuteSynchronously);
}

if (message is ForceDisassociate || message is ForceDisassociateExplicitly)
{
return manager.Ask(message, AskTimeout).ContinueWith(r => r.Result is ForceDisassociateAck,
TaskContinuationOptions.AttachedToParent |
TaskContinuationOptions.ExecuteSynchronously |
TaskContinuationOptions.OnlyOnRanToCompletion);
TaskContinuationOptions.ExecuteSynchronously);
}

return WrappedTransport.ManagementCommand(message);
Expand Down

0 comments on commit 1ea39bf

Please sign in to comment.