From 5ec4fcc33bfa37401e4c900d799bfe9f05d7aa97 Mon Sep 17 00:00:00 2001 From: Olivier Vielpeau Date: Mon, 15 Mar 2021 12:03:13 +0100 Subject: [PATCH 1/2] [win pipes] Defer connection establishment to first write Allows the client creation call (`New`) call with a windows named pipe target address to be successful even if the Agent hasn't created the named pipe yet. This new behavior is consistent with the UDS writer. --- statsd/pipe_windows.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/statsd/pipe_windows.go b/statsd/pipe_windows.go index c820318b..beb4711c 100644 --- a/statsd/pipe_windows.go +++ b/statsd/pipe_windows.go @@ -75,9 +75,9 @@ func (p *pipeWriter) Close() error { } func newWindowsPipeWriter(pipepath string) (*pipeWriter, error) { - conn, err := winio.DialPipe(pipepath, nil) + // Defer connection establishment to first write return &pipeWriter{ - conn: conn, + conn: nil, timeout: defaultPipeTimeout, pipepath: pipepath, }, err From 301747e3843eab5c7be124eb0b3f287d8294fdd6 Mon Sep 17 00:00:00 2001 From: Olivier Vielpeau Date: Mon, 15 Mar 2021 12:28:24 +0100 Subject: [PATCH 2/2] Fix error returned --- statsd/pipe_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/statsd/pipe_windows.go b/statsd/pipe_windows.go index beb4711c..f533b024 100644 --- a/statsd/pipe_windows.go +++ b/statsd/pipe_windows.go @@ -80,5 +80,5 @@ func newWindowsPipeWriter(pipepath string) (*pipeWriter, error) { conn: nil, timeout: defaultPipeTimeout, pipepath: pipepath, - }, err + }, nil }