libnetwork/diagnostic: drop Init method

Fold it into the constructor, because that's what the constructor is
supposed to do.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider 2023-10-31 12:19:32 -04:00
parent f270057e0c
commit 757a004a90
3 changed files with 3 additions and 10 deletions

View file

@ -52,7 +52,6 @@ func Server(args []string) {
log.G(context.TODO()).Infof("%s uses IP %s\n", localNodeName, ipAddr)
server = diagnostic.New()
server.Init()
conf := networkdb.DefaultConfig()
conf.Hostname = localNodeName
conf.AdvertiseAddr = ipAddr

View file

@ -115,7 +115,6 @@ func New(cfgOptions ...config.Option) (*Controller, error) {
networkLocker: locker.New(),
DiagnosticServer: diagnostic.New(),
}
c.DiagnosticServer.Init()
if err := c.initStores(); err != nil {
return nil, err

View file

@ -49,17 +49,12 @@ type Server struct {
// New creates a new diagnostic server
func New() *Server {
return &Server{
s := &Server{
mux: http.NewServeMux(),
registeredHanders: make(map[string]bool),
}
}
// Init initialize the mux for the http handling and register the base hooks
func (s *Server) Init() {
s.mux = http.NewServeMux()
// Register local handlers
s.RegisterHandler(s, diagPaths2Func)
return s
}
// RegisterHandler allows to register new handlers to the mux and to a specific path