]> Cypherpunks repositories - gostls13.git/commitdiff
net/textproto: close channel to signal pipeline event completion
authorTim Cooper <tim.cooper@layeh.com>
Thu, 27 Feb 2020 18:26:36 +0000 (12:26 -0600)
committerIan Lance Taylor <iant@golang.org>
Thu, 27 Feb 2020 23:19:45 +0000 (23:19 +0000)
Change-Id: I7e4827b3428b48c67060789a528586a8907ca3db
Reviewed-on: https://go-review.googlesource.com/c/go/+/221418
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/textproto/pipeline.go

index 2e283218b50807f3327820c796572501993a98b8..e2d9af34c5718b53f21e47ee51606078d356da79 100644 (file)
@@ -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)
        }
 }