This commit is contained in:
aler9 2021-11-03 16:37:08 +01:00
parent 8b6d8766b3
commit aa01eaf12b
2 changed files with 10 additions and 10 deletions

View File

@ -34,8 +34,8 @@ type metricsParent interface {
}
type metrics struct {
listener net.Listener
server *http.Server
ln net.Listener
server *http.Server
mutex sync.Mutex
pathManager metricsPathManager
@ -48,13 +48,13 @@ func newMetrics(
address string,
parent metricsParent,
) (*metrics, error) {
listener, err := net.Listen("tcp", address)
ln, err := net.Listen("tcp", address)
if err != nil {
return nil, err
}
m := &metrics{
listener: listener,
ln: ln,
}
router := gin.New()
@ -74,7 +74,7 @@ func (m *metrics) close() {
}
func (m *metrics) run() {
err := m.server.Serve(m.listener)
err := m.server.Serve(m.ln)
if err != http.ErrServerClosed {
panic(err)
}

View File

@ -16,21 +16,21 @@ type pprofParent interface {
}
type pprof struct {
listener net.Listener
server *http.Server
ln net.Listener
server *http.Server
}
func newPPROF(
address string,
parent pprofParent,
) (*pprof, error) {
listener, err := net.Listen("tcp", address)
ln, err := net.Listen("tcp", address)
if err != nil {
return nil, err
}
pp := &pprof{
listener: listener,
ln: ln,
}
pp.server = &http.Server{
@ -49,7 +49,7 @@ func (pp *pprof) close() {
}
func (pp *pprof) run() {
err := pp.server.Serve(pp.listener)
err := pp.server.Serve(pp.ln)
if err != http.ErrServerClosed {
panic(err)
}