We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9d32dd6 commit 71048cdCopy full SHA for 71048cd
pipe.go
@@ -11,6 +11,7 @@ import (
11
"net"
12
"os"
13
"runtime"
14
+ "sync"
15
"time"
16
"unsafe"
17
@@ -316,6 +317,7 @@ type win32PipeListener struct {
316
317
path string
318
config PipeConfig
319
acceptCh chan (chan acceptResponse)
320
+ closeOnce sync.Once
321
closeCh chan struct{}
322
doneCh chan struct{}
323
}
@@ -573,14 +575,10 @@ func (l *win32PipeListener) Accept() (net.Conn, error) {
573
575
574
576
577
func (l *win32PipeListener) Close() error {
- select {
- case <-l.doneCh:
578
- case <-l.closeCh:
579
- <-l.doneCh
580
- default:
+ l.closeOnce.Do(func() {
581
close(l.closeCh)
582
583
- }
+ })
+ <-l.doneCh
584
return nil
585
586
0 commit comments