Skip to content

Commit 926f923

Browse files
refactor
1 parent b9a418b commit 926f923

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

proxy/proxy.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ func (p *Server) Start() error {
5555
if p.isStarted() {
5656
return nil
5757
}
58-
p.started.Store(true)
5958

6059
// Start HTTP server with custom listener for TLS detection
6160
go func() {
@@ -82,6 +81,8 @@ func (p *Server) Start() error {
8281
}
8382
}()
8483

84+
p.started.Store(true)
85+
8586
return nil
8687
}
8788

@@ -93,12 +94,14 @@ func (p *Server) Stop() error {
9394
p.started.Store(false)
9495

9596
if p.listener == nil {
96-
return errors.New("listener is nil; server was not started")
97+
p.logger.Error("unexpected nil listener")
98+
return errors.New("unexpected nil listener")
9799
}
98100

99101
err := p.listener.Close()
100102
if err != nil {
101103
p.logger.Error("Failed to close listener", "error", err)
104+
return err
102105
}
103106

104107
return nil

0 commit comments

Comments
 (0)