Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
RussKie committed Jul 11, 2023
1 parent 8f6e598 commit 1010c08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ internal sealed class TcpEndpointHealthCheckService : BackgroundService
private readonly ILogger<TcpEndpointHealthCheckService> _logger;
private readonly HealthCheckService _healthCheckService;
private readonly KubernetesProbesOptions.EndpointOptions _options;
#pragma warning disable CA2213 // 'TcpEndpointHealthCheckService' contains field '_listener' that is of IDisposable type 'TcpListener'
private readonly TcpListener _listener;
#pragma warning restore CA2213

public TcpEndpointHealthCheckService(ILogger<TcpEndpointHealthCheckService> logger, HealthCheckService healthCheckService, KubernetesProbesOptions.EndpointOptions options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ private static bool IsTcpOpened(int port)

private static int GetFreeTcpPort()
{
#pragma warning disable CA2000 // Dispose objects before losing scope
var listener = new TcpListener(IPAddress.Loopback, 0);
#pragma warning restore CA2000 // Dispose objects before losing scope
listener.Start();
int port = ((IPEndPoint)listener.LocalEndpoint).Port;
listener.Stop();
Expand Down

0 comments on commit 1010c08

Please sign in to comment.