fix TLS initialization for the TCP h2quic Server

This commit is contained in:
Julien Benoist
2017-09-20 16:49:18 -07:00
committed by Marten Seemann
parent faa8a1ec1a
commit ce9132e324

View File

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