Merge pull request #617 from lucas-clemente/fix-615

return an error when calling OpenStream after the session was closed
This commit is contained in:
Marten Seemann
2017-05-15 19:55:51 +08:00
committed by GitHub
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