Exemple #1
0
func newClient(addr, network string) *client.GhostClient {
	return client.New(&client.Options{
		Addr:        addr,
		Network:     network,
		PoolSize:    clients,
		PoolTimeout: time.Duration(poolTimeout) * time.Second,
	})
}
Exemple #2
0
func init() {
	go server.GhostRun(&server.Options{Addr: "localhost:6869"})

	// Wait until server start
	// Yep, ugly. Tell if you know better solution
	time.Sleep(1 * time.Second)
	c = client.New(&client.Options{Addr: "localhost:6869"})
}
Exemple #3
0
func connect(addr, network string) (*client.GhostClient, error) {
	c := client.New(&client.Options{
		Addr:    addr,
		Network: network,
	})

	if _, err := c.Ping(); err != nil {
		return nil, errors.New(fmt.Sprintf("cli-ghost: cannot obtain connection to %s", addr))
	}

	log.Printf("Connection to %s is successfull.", addr)
	return c, nil
}