mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-10 08:59:57 +00:00
cleanup
This commit is contained in:
parent
8b6d8766b3
commit
aa01eaf12b
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user