From cc3f8ddb2096307997e65a7085ad5dcb01c69bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Seguin?= Date: Wed, 18 Jun 2025 18:02:33 +0200 Subject: [PATCH] Close the connection after the TCP check has completed --- Haproxy.AgentCheck/Endpoints/TcpHandler.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Haproxy.AgentCheck/Endpoints/TcpHandler.cs b/Haproxy.AgentCheck/Endpoints/TcpHandler.cs index d001b6b..4c90534 100644 --- a/Haproxy.AgentCheck/Endpoints/TcpHandler.cs +++ b/Haproxy.AgentCheck/Endpoints/TcpHandler.cs @@ -25,6 +25,9 @@ public override async Task OnConnectedAsync(ConnectionContext connection) await connection.Transport.Output.WriteAsync(Encoding.ASCII.GetBytes($"{state.Weight:F0}% {up}\n").AsMemory(), connection.ConnectionClosed); await connection.Transport.Output.FlushAsync(connection.ConnectionClosed); + + await connection.Transport.Output.CompleteAsync(); + await connection.Transport.Input.CompleteAsync(); } catch (TaskCanceledException) when (connection.ConnectionClosed.IsCancellationRequested) {