From 7340e5a1e86311302c6fcc3a86afe7ff9cbf5e49 Mon Sep 17 00:00:00 2001 From: Tim Cooper Date: Thu, 27 Feb 2020 12:26:36 -0600 Subject: [PATCH] net/textproto: close channel to signal pipeline event completion Change-Id: I7e4827b3428b48c67060789a528586a8907ca3db Reviewed-on: https://go-review.googlesource.com/c/go/+/221418 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- src/net/textproto/pipeline.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/net/textproto/pipeline.go b/src/net/textproto/pipeline.go index 2e283218b5..e2d9af34c5 100644 --- a/src/net/textproto/pipeline.go +++ b/src/net/textproto/pipeline.go @@ -72,7 +72,7 @@ func (p *Pipeline) EndResponse(id uint) { type sequencer struct { mu sync.Mutex id uint - wait map[uint]chan uint + wait map[uint]chan struct{} } // Start waits until it is time for the event numbered id to begin. @@ -84,9 +84,9 @@ func (s *sequencer) Start(id uint) { s.mu.Unlock() return } - c := make(chan uint) + c := make(chan struct{}) if s.wait == nil { - s.wait = make(map[uint]chan uint) + s.wait = make(map[uint]chan struct{}) } s.wait[id] = c s.mu.Unlock() @@ -104,7 +104,7 @@ func (s *sequencer) End(id uint) { id++ s.id = id if s.wait == nil { - s.wait = make(map[uint]chan uint) + s.wait = make(map[uint]chan struct{}) } c, ok := s.wait[id] if ok { @@ -112,6 +112,6 @@ func (s *sequencer) End(id uint) { } s.mu.Unlock() if ok { - c <- 1 + close(c) } } -- 2.50.0