Skip to content

Commit

Permalink
CLIENT-3256: Fixes to Pool<T> class, load balancer detection and Asyn…
Browse files Browse the repository at this point in the history
…cOperateWrite (#142)

* Disable load balancer address detection for localhost

* Incorrect behavior of Pool<T>.PeekFirst

* Listener is not copied when AsyncOperateWrite is cloned
  • Loading branch information
volgunin-ttd authored Jan 9, 2025
1 parent 4f17f5c commit a79c1ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions AerospikeClient/Async/AsyncOperateWrite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public AsyncOperateWrite(AsyncCluster cluster, RecordListener listener, Key key,
public AsyncOperateWrite(AsyncOperateWrite other)
: base(other)
{
this.listener = other.listener;
this.args = other.args;
}

Expand Down
5 changes: 4 additions & 1 deletion AerospikeClient/Cluster/NodeValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ private void ValidateAddress(Cluster cluster, IPAddress address, string tlsName,
// Disable load balancer detection for localhost.
detectLoadBalancer = false;
}

}

if (detectLoadBalancer)
{
// Seed may be load balancer with changing address. Determine real address.
addressCommand = (cluster.tlsPolicy != null) ?
cluster.useServicesAlternate ? "service-tls-alt" : "service-tls-std" :
Expand Down
2 changes: 1 addition & 1 deletion AerospikeClient/Cluster/Pool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public T PeekFirst()
return default;
}

return items[head];
return items[head == 0 ? items.Length - 1 : head - 1];
}
finally
{
Expand Down

0 comments on commit a79c1ef

Please sign in to comment.