forked from quic-go/quic-go
@@ -4,6 +4,7 @@ import (
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -61,6 +62,11 @@ func (s *Server) ListenAndServeTLS(certFile, keyFile string) error {
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
||||
// Serve should not be called, since it only works properly for TCP listeners.
|
||||
func (Server) Serve(net.Listener) error {
|
||||
panic("h2quic.Server.Serve should not be called, see https://godoc.org/github.com/lucas-clemente/quic-go/h2quic")
|
||||
}
|
||||
|
||||
func (s *Server) handleStreamCb(session *quic.Session, stream utils.Stream) {
|
||||
s.handleStream(session, stream)
|
||||
}
|
||||
|
||||
@@ -151,4 +151,10 @@ var _ = Describe("H2 server", func() {
|
||||
s.handleStream(session, headerStream)
|
||||
Eventually(func() bool { return handlerCalled }).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should panic when Serve() is called", func() {
|
||||
Expect(func() {
|
||||
Server{}.Serve(nil)
|
||||
}).To(Panic())
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user