Update readme.md

This commit is contained in:
Alex Grin 2019-01-31 10:03:34 -05:00 committed by GitHub
parent 51d03937c2
commit d79ed15728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,12 +86,6 @@ func (s *Server) Start(address string) error {
} }
log.Println("listening on " + address) log.Println("listening on " + address)
s.grp.Add(1)
go func() {
defer s.grp.Done()
s.listenAndServe(l)
}()
s.grp.Add(1) s.grp.Add(1)
go func() { go func() {
defer s.grp.Done() 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() s := NewServer()
log.Println("starting") log.Println("starting")
s.Start("localhost:1234") go s.Start("localhost:1234")
log.Println("started")
// ... do some other things here ... // ... do some other things here ...