add a method to the session that blocks until it is closed

This commit is contained in:
Marten Seemann 2017-06-15 19:11:22 +02:00
parent 95c3db90a8
commit cd02cc8f0f
No known key found for this signature in database
GPG key ID: 3603F40B121FCDEA
5 changed files with 24 additions and 0 deletions

View file

@ -772,6 +772,17 @@ var _ = Describe("Session", func() {
Expect(mconn.written[0][0] & 0x02).ToNot(BeZero()) // Public Reset
Expect(sess.runClosed).To(BeClosed())
})
It("unblocks WaitUntilClosed when the run loop exists", func() {
returned := make(chan struct{})
go func() {
sess.WaitUntilClosed()
close(returned)
}()
Consistently(returned).ShouldNot(BeClosed())
sess.Close(nil)
Eventually(returned).Should(BeClosed())
})
})
Context("receiving packets", func() {