updated spdystream (lock)
Juan Batiz-Benet committed
Dec 31, 2014 at 07:22 UTC
5f603deecddd53e0587437a8d27e919c0bf19de7
2 files changed
+4
-1
Godeps/Godeps.json
+1
-1
@@ -145,7 +145,7 @@
145
},
146
{
147
"ImportPath": "github.com/jbenet/spdystream",
148
- "Rev": "ebaae88f58b8042aae386bd3972d07cf9a892a4b"
148
+ "Rev": "6daa2792a4c92f14c76b2b1caa99a76824f7705c"
149
},
150
{
151
"ImportPath": "github.com/kr/binarydist",
Godeps/_workspace/src/github.com/jbenet/spdystream/stream.go
+3
@@ -34,6 +34,7 @@ type Stream struct {
34
replied bool
35
closeChan chan bool
36
37
+ shutdownLock sync.Mutex
38
shutdownChan chan struct{} // closed when Reset is called (no more R/W).
39
}
40
@@ -170,12 +171,14 @@ func (s *Stream) Reset() error {
171
s.conn.removeStream(s)
172
173
// only close it once.
174
+ s.shutdownLock.Lock()
175
select {
176
case <-s.shutdownChan:
177
// already was closed.
178
default:
179
close(s.shutdownChan)
180
}
181
+ s.shutdownLock.Unlock()
182
183
s.finishLock.Lock()
184
if s.finished {