Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wzshiming committed Nov 21, 2020
1 parent 0bf667d commit 5f06875
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 18 deletions.
8 changes: 1 addition & 7 deletions components/protocol/http/pprof/init.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package pprof

import (
"net/http"

"github.com/pipeproxy/pipe/components/common/register"
)

Expand All @@ -11,9 +9,5 @@ const (
)

func init() {
register.Register(name, NewPprofWithConfig)
}

func NewPprofWithConfig() http.Handler {
return NewPprof()
register.Register(name, NewPprof)
}
2 changes: 1 addition & 1 deletion components/protocol/http/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
type Pprof struct {
}

func NewPprof() Pprof {
func NewPprof() http.Handler {
return Pprof{}
}

Expand Down
7 changes: 1 addition & 6 deletions components/protocol/http/quit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ package quit

import (
"github.com/pipeproxy/pipe/components/common/register"
"github.com/pipeproxy/pipe/components/protocol/http"
)

const (
name = "quit"
)

func init() {
register.Register(name, NewPprofWithConfig)
}

func NewPprofWithConfig() http.Handler {
return NewQuit()
register.Register(name, NewQuit)
}
8 changes: 4 additions & 4 deletions components/protocol/http/quit/quit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"github.com/pipeproxy/pipe/internal/logger"
)

func NewQuit() *ConfigQuit {
return &ConfigQuit{}
type Quit struct {
}

type ConfigQuit struct {
func NewQuit() http.Handler {
return &Quit{}
}

func (c *ConfigQuit) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
func (c *Quit) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
svc, ok := pipe.GetPipeWithContext(r.Context())
if !ok {
http.Error(rw, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
Expand Down

0 comments on commit 5f06875

Please sign in to comment.