forked from quic-go/quic-go
return an error when calling OpenStream after the session was closed
fixes #615
This commit is contained in:
@@ -166,6 +166,9 @@ func (m *streamsMap) OpenStream() (*stream, error) {
|
|||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
|
|
||||||
|
if m.closeErr != nil {
|
||||||
|
return nil, m.closeErr
|
||||||
|
}
|
||||||
return m.openStreamImpl()
|
return m.openStreamImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,13 @@ var _ = Describe("Streams Map", func() {
|
|||||||
Expect(err).To(MatchError(testErr))
|
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() {
|
Context("counting streams", func() {
|
||||||
var maxNumStreams int
|
var maxNumStreams int
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user