diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-11-27 16:18:08 +0000 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-11-27 16:18:08 +0000 |
| commit | 2336eb2530e1f6df6817f309e0ea2a4102056967 (patch) | |
| tree | ff78784b06a76890ea2150e0befbe89611e1062d | |
| parent | 10843b7318e949fcd3120d843352271ef198be11 (diff) | |
Revert "Close pipe if PipeListener.DialContext errors out"
This reverts commit 2bfa4630c7223ee11ec29b91107333758e7f2a8e.
It basically is not necessary to close the underlying channel.
| -rw-r--r-- | net.go | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -63,19 +63,16 @@ func (p *PipeListener) Dial(_, _ string) (net.Conn, error) { return p.DialContext(context.Background(), "", "") } -func (p *PipeListener) DialContext(ctx context.Context, _, _ string) (_ net.Conn, err error) { +func (p *PipeListener) DialContext(ctx context.Context, _, _ string) (net.Conn, error) { s, c := net.Pipe() select { case p.conns <- s: return c, nil case <-p.done: - err = syscall.ECONNREFUSED + return nil, syscall.ECONNREFUSED case <-ctx.Done(): - err = ctx.Err() + return nil, ctx.Err() } - s.Close() - c.Close() - return } func (p *PipeListener) DialContextGRPC(ctx context.Context, _ string) (net.Conn, error) { |
