From b9438f017464b946307af53230e17f7ea78af340 Mon Sep 17 00:00:00 2001 From: Zlatko Bratkovic Date: Fri, 29 Mar 2024 13:27:43 +0100 Subject: [PATCH] BUG/MINOR: runtime: use correct check when calculating max byte size --- pkg/haproxy/api/runtime.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/haproxy/api/runtime.go b/pkg/haproxy/api/runtime.go index 1dffff2a..0dca51ce 100644 --- a/pkg/haproxy/api/runtime.go +++ b/pkg/haproxy/api/runtime.go @@ -42,7 +42,7 @@ func (c *clientNative) SetServerAddrAndState(servers []RuntimeServerData) error return nil } backendNameSize := len(servers[0].BackendName) - oneServerCommandSize := 65 + 2*backendNameSize + oneServerCommandSize := 75 + 2*backendNameSize size := oneServerCommandSize * len(servers) if size > BufferSize { size = BufferSize @@ -73,7 +73,7 @@ func (c *clientNative) SetServerAddrAndState(servers []RuntimeServerData) error cmdBuilder.WriteString(";") // if new commands are added recalculate oneServerCommandSize - if sb.Len()+cmdBuilder.Len() >= size { + if sb.Len()+cmdBuilder.Len() >= BufferSize { err = c.runRaw(runtime, sb, server.BackendName) if err != nil { return err