Merge pull request #842 from lucas-clemente/jbenoist-master

fixes in server setup and h2quic
This commit is contained in:
Lucas Clemente
2017-09-23 01:41:12 +02:00
committed by GitHub
3 changed files with 8 additions and 1 deletions

View File

@@ -344,6 +344,9 @@ func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error
}
defer tcpConn.Close()
tlsConn := tls.NewListener(tcpConn, config)
defer tlsConn.Close()
// Start the servers
httpServer := &http.Server{
Addr: addr,
@@ -365,7 +368,7 @@ func ListenAndServe(addr, certFile, keyFile string, handler http.Handler) error
hErr := make(chan error)
qErr := make(chan error)
go func() {
hErr <- httpServer.Serve(tcpConn)
hErr <- httpServer.Serve(tlsConn)
}()
go func() {
qErr <- quicServer.Serve(udpConn)

View File

@@ -149,6 +149,7 @@ func populateServerConfig(config *Config) *Config {
HandshakeTimeout: handshakeTimeout,
IdleTimeout: idleTimeout,
AcceptCookie: vsa,
KeepAlive: config.KeepAlive,
MaxReceiveStreamFlowControlWindow: maxReceiveStreamFlowControlWindow,
MaxReceiveConnectionFlowControlWindow: maxReceiveConnectionFlowControlWindow,
}

View File

@@ -349,6 +349,7 @@ var _ = Describe("Server", func() {
AcceptCookie: acceptCookie,
HandshakeTimeout: 1337 * time.Hour,
IdleTimeout: 42 * time.Minute,
KeepAlive: true,
}
ln, err := Listen(conn, &tls.Config{}, &config)
Expect(err).ToNot(HaveOccurred())
@@ -360,6 +361,7 @@ var _ = Describe("Server", func() {
Expect(server.config.HandshakeTimeout).To(Equal(1337 * time.Hour))
Expect(server.config.IdleTimeout).To(Equal(42 * time.Minute))
Expect(reflect.ValueOf(server.config.AcceptCookie)).To(Equal(reflect.ValueOf(acceptCookie)))
Expect(server.config.KeepAlive).To(BeTrue())
})
It("fills in default values if options are not set in the Config", func() {
@@ -370,6 +372,7 @@ var _ = Describe("Server", func() {
Expect(server.config.HandshakeTimeout).To(Equal(protocol.DefaultHandshakeTimeout))
Expect(server.config.IdleTimeout).To(Equal(protocol.DefaultIdleTimeout))
Expect(reflect.ValueOf(server.config.AcceptCookie)).To(Equal(reflect.ValueOf(defaultAcceptCookie)))
Expect(server.config.KeepAlive).To(BeFalse())
})
It("listens on a given address", func() {