Skip to content

Commit

Permalink
flathttp: reposition methods in server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed May 24, 2020
1 parent 14143d8 commit b00748d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions flathttp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,32 @@ func NewServer(cfg *Config) *Server {
return srv
}

func (s *Server) Update(cfg *Config) {
func (s *Server) Start() []error {
s.lm.Lock()
defer s.lm.Unlock()

if cfg == nil {
cfg = &Config{}
err := s.start()
if err != nil {
return append([]error{err}, s.stop()...)
}
s.cfg = *cfg
return nil
}

func (s *Server) Start() []error {
func (s *Server) Stop() []error {
s.lm.Lock()
defer s.lm.Unlock()

err := s.start()
if err != nil {
return append([]error{err}, s.stop()...)
return s.stop()
}

func (s *Server) Update(cfg *Config) {
s.lm.Lock()
defer s.lm.Unlock()

if cfg == nil {
cfg = &Config{}
}
return nil
s.cfg = *cfg
}

func (s *Server) start() error {
Expand Down Expand Up @@ -128,13 +135,6 @@ func (s *Server) listen(a Addr) error {
return nil
}

func (s *Server) Stop() []error {
s.lm.Lock()
defer s.lm.Unlock()

return s.stop()
}

func (s *Server) stop() []error {
var errs []error

Expand Down

0 comments on commit b00748d

Please sign in to comment.