func main() { flag.Parse() var serfClient *agent.RPCClient var err error interval := 1 * time.Second for { serfClient, err = agent.NewRPCClient(*serfAgentRPCAddr) if err == nil { break } log.Println( "failed to reach serf agent at", *serfAgentRPCAddr, "trying again in", interval, ) time.Sleep(interval) } pool := warden_pool.New(serfClient) err = pool.Listen() if err != nil { log.Fatalln("failed to listen for events:", err) } addrs := strings.Split(*serfMembers, ",") joinedCount, err := serfClient.Join(addrs, false) if err != nil { log.Fatalln("failed to join serf cluster:", err) } log.Println("joined", joinedCount, "members of serf cluster") select {} }
// RPCClient returns a new Serf RPC client with the given address. func RPCClient(addr string) (*agent.RPCClient, error) { return agent.NewRPCClient(addr) }