1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

caddy: Start all servers only after all listeners successful (#2508)

This commit is contained in:
Aka.Why 2019-03-11 11:01:56 +08:00 committed by Matt Holt
parent 47b78714b8
commit 397d67876c

View file

@ -781,6 +781,10 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
}
}
inst.servers = append(inst.servers, ServerListener{server: s, listener: ln, packet: pc})
}
for _, s := range inst.servers {
inst.wg.Add(2)
stopWg.Add(2)
func(s Server, ln net.Listener, pc net.PacketConn, inst *Instance) {
@ -799,9 +803,7 @@ func startServers(serverList []Server, inst *Instance, restartFds map[string]res
}()
errChan <- s.ServePacket(pc)
}()
}(s, ln, pc, inst)
inst.servers = append(inst.servers, ServerListener{server: s, listener: ln, packet: pc})
}(s.server, s.listener, s.packet, inst)
}
// Log errors that may be returned from Serve() calls,