return an error when calling OpenStream after the session was closed

fixes #615
This commit is contained in:
Marten Seemann
2017-05-14 13:56:38 +08:00
parent 222ffa2f48
commit ba16a80864
2 changed files with 10 additions and 0 deletions

View File

@@ -166,6 +166,9 @@ func (m *streamsMap) OpenStream() (*stream, error) {
m.mutex.Lock()
defer m.mutex.Unlock()
if m.closeErr != nil {
return nil, m.closeErr
}
return m.openStreamImpl()
}

View File

@@ -181,6 +181,13 @@ var _ = Describe("Streams Map", func() {
Expect(err).To(MatchError(testErr))
})
It("returns the error when the streamsMap was closed", func() {
testErr := errors.New("test error")
m.CloseWithError(testErr)
_, err := m.OpenStream()
Expect(err).To(MatchError(testErr))
})
Context("counting streams", func() {
var maxNumStreams int