Skip to content

Commit cbaa068

Browse files
committed
Address review comments
1 parent c880254 commit cbaa068

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

exporter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,9 @@ func registerCollector(logger *slog.Logger, transport *http.Transport,
281281

282282
// as we do not use any TLVs, header size should be pretty small, hence we only check for error, assuming the whole header went out in a single packet
283283
_, err = header.WriteTo(conn)
284-
if err != nil {
285-
return nil, fmt.Errorf("writing proxyproto header: %w", err)
284+
if err == nil {
285+
conn.Close()
286+
return nil, fmt.Errorf("writing proxyproto header via %s to %s: %w", network, addr, err)
286287
}
287288

288289
return conn, nil

0 commit comments

Comments
 (0)