cmd/routed: syncgroup better

This commit is contained in:
Cadey Ratio 2018-01-20 09:33:32 -08:00
parent cce1197484
commit b628042e29
1 changed files with 1 additions and 2 deletions

View File

@ -52,6 +52,7 @@ func main() {
} }
wg := &sync.WaitGroup{} wg := &sync.WaitGroup{}
wg.Add(3)
go setupQuic(ctx, wg, s, scfg) go setupQuic(ctx, wg, s, scfg)
go setupTLS(ctx, wg, s, scfg) go setupTLS(ctx, wg, s, scfg)
@ -121,7 +122,6 @@ func setupQuic(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config)
s.QuicServer = qs s.QuicServer = qs
go ln.FatalErr(context.Background(), qs.ListenAndServe()) go ln.FatalErr(context.Background(), qs.ListenAndServe())
wg.Add(1)
for { for {
select { select {
@ -152,7 +152,6 @@ func setupTLS(ctx context.Context, wg *sync.WaitGroup, s *Server, scfg Config) {
} }
go ln.FatalErr(context.Background(), hs.ListenAndServeTLS("", "")) go ln.FatalErr(context.Background(), hs.ListenAndServeTLS("", ""))
wg.Add(1)
for { for {
select { select {