Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

experimenting with RemoteActorRefProvider address resolution performance #5228

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/Akka.Remote/RemoteActorRefProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public Deploy LookUpRemotes(IEnumerable<string> p)

public bool HasAddress(Address address)
{
return address == _local.RootPath.Address || address == RootPath.Address || Transport.Addresses.Any(a => a == address);
return address.Equals(_local.RootPath.Address) || address.Equals(RootPath.Address) || Transport.Addresses.Contains(address);
}

/// <summary>
Expand Down
7 changes: 4 additions & 3 deletions src/core/Akka/Actor/Address.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml.Xsl;
using Akka.Util;

namespace Akka.Actor
Expand Down Expand Up @@ -154,7 +155,7 @@ public bool Equals(Address other)
}

/// <inheritdoc/>
public override bool Equals(object obj) => obj is Address && Equals((Address)obj);
public override bool Equals(object obj) => Equals(obj as Address);

/// <inheritdoc/>
public override int GetHashCode()
Expand Down Expand Up @@ -245,7 +246,7 @@ public Address WithPort(int? port = null)
/// <returns><c>true</c> if both addresses are equal; otherwise <c>false</c></returns>
public static bool operator ==(Address left, Address right)
{
return Equals(left, right);
return left?.Equals(right) ?? ReferenceEquals(right, null);
}

/// <summary>
Expand All @@ -256,7 +257,7 @@ public Address WithPort(int? port = null)
/// <returns><c>true</c> if both addresses are not equal; otherwise <c>false</c></returns>
public static bool operator !=(Address left, Address right)
{
return !Equals(left, right);
return !(left == right);
}

/// <summary>
Expand Down