start running TLS server session directly when creating them

This commit is contained in:
Marten Seemann
2018-05-20 13:56:26 +08:00
parent e98228df9d
commit ef34d9e85f
4 changed files with 23 additions and 9 deletions

View File

@@ -153,17 +153,18 @@ var _ = Describe("Server", func() {
It("accepts new TLS sessions", func() {
connID := protocol.ConnectionID{1, 2, 3, 4, 5, 6, 7, 8}
run := make(chan struct{})
sess := NewMockPacketHandler(mockCtrl)
sess.EXPECT().run().Do(func() { close(run) })
err := serv.setupTLS()
Expect(err).ToNot(HaveOccurred())
sessionHandler.EXPECT().Add(connID, sess)
added := make(chan struct{})
sessionHandler.EXPECT().Add(connID, sess).Do(func(protocol.ConnectionID, packetHandler) {
close(added)
})
serv.serverTLS.sessionChan <- tlsSession{
connID: connID,
sess: sess,
}
Eventually(run).Should(BeClosed())
Eventually(added).Should(BeClosed())
})
It("accepts a session once the connection it is forward secure", func() {