diff --git a/extras/stop/readme.md b/extras/stop/readme.md index 8dfc3f9..c26ef83 100644 --- a/extras/stop/readme.md +++ b/extras/stop/readme.md @@ -86,12 +86,6 @@ func (s *Server) Start(address string) error { } log.Println("listening on " + address) - s.grp.Add(1) - go func() { - defer s.grp.Done() - s.listenAndServe(l) - }() - s.grp.Add(1) go func() { defer s.grp.Done() @@ -115,7 +109,8 @@ func (s *Server) Start(address string) error { } }() - return nil + // listenAndServe blocks until the server is shut down, just like http.ListenAndServe() + return s.listenAndServe(l) } @@ -123,8 +118,7 @@ func (s *Server) Start(address string) error { s := NewServer() log.Println("starting") -s.Start("localhost:1234") -log.Println("started") +go s.Start("localhost:1234") // ... do some other things here ...