Skip to content

Commit

Permalink
http_(proxy,server): remove Listener
Browse files Browse the repository at this point in the history
The listener injection is not used and collides with the followup changes.
  • Loading branch information
mmatczuk committed Sep 11, 2023
1 parent df50e5f commit 212cbb6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
5 changes: 0 additions & 5 deletions http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type HTTPProxy struct {
addr atomic.Pointer[string]

TLSConfig *tls.Config
Listener net.Listener
}

func NewHTTPProxy(cfg *HTTPProxyConfig, pr PACResolver, cm *CredentialsMatcher, rt http.RoundTripper, log log.Logger) (*HTTPProxy, error) {
Expand Down Expand Up @@ -521,10 +520,6 @@ func (hp *HTTPProxy) Run(ctx context.Context) error {
}

func (hp *HTTPProxy) listener() (net.Listener, error) {
if hp.Listener != nil {
return hp.Listener, nil
}

listener, err := net.Listen("tcp", hp.config.Addr)
if err != nil {
return nil, fmt.Errorf("failed to open listener on address %s: %w", hp.config.Addr, err)
Expand Down
6 changes: 0 additions & 6 deletions http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ type HTTPServer struct {
log log.Logger
srv *http.Server
addr atomic.Pointer[string]

Listener net.Listener
}

func NewHTTPServer(cfg *HTTPServerConfig, h http.Handler, log log.Logger) (*HTTPServer, error) {
Expand Down Expand Up @@ -234,10 +232,6 @@ func (hs *HTTPServer) Run(ctx context.Context) error {
}

func (hs *HTTPServer) listener() (net.Listener, error) {
if hs.Listener != nil {
return hs.Listener, nil
}

switch hs.config.Protocol {
case HTTPScheme, HTTPSScheme, HTTP2Scheme:
listener, err := net.Listen("tcp", hs.srv.Addr)
Expand Down

0 comments on commit 212cbb6

Please sign in to comment.