func NewClient(config *skynet.ClientConfig) *Client { // Sanity checks (nil pointers are baaad) if config.Log == nil { config.Log = skynet.NewConsoleSemanticLogger("skynet", os.Stderr) } if config.DoozerConfig == nil { config.DoozerConfig = &skynet.DoozerConfig{Uri: "localhost:8046"} } if config.MaxConnectionsToInstance == 0 { config.Log.Fatal("Must allow at least one instance connection") } doozerConn := skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log) client := &Client{ Config: config, DoozerConn: doozerConn, Log: config.Log, servicePools: map[string]*servicePool{}, } client.Log.Trace(fmt.Sprintf("Created client '%+v'", client)) client.DoozerConn.Connect() client.instanceMonitor = NewInstanceMonitor(client.DoozerConn, false) return client }
func (c *Client) doozer() skynet.DoozerConnection { if c.DoozerConn == nil { c.DoozerConn = skynet.NewDoozerConnectionFromConfig(*c.Config.DoozerConfig, c.Config.Log) c.DoozerConn.Connect() } return c.DoozerConn }
// only call this from doozerMux func (s *Service) doozer() skynet.DoozerConnection { if s.DoozerConn == nil { s.DoozerConn = skynet.NewDoozerConnectionFromConfig(*s.Config.DoozerConfig, s.Log) s.DoozerConn.Connect() } return s.DoozerConn }
func NewClient(config *skynet.ClientConfig) *Client { if config.Log == nil { config.Log = skynet.NewConsoleLogger(os.Stderr) } if config.ConnectionPoolSize == 0 { config.ConnectionPoolSize = 1 } client := &Client{ Config: config, DoozerConn: skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log), Log: config.Log, } client.Log.Item(config) client.DoozerConn.Connect() return client }
func NewClient(config *skynet.ClientConfig) *Client { if config.Log == nil { config.Log = skynet.NewConsoleLogger(os.Stderr) } if config.ConnectionPoolSize == 0 { config.ConnectionPoolSize = 1 } client := &Client{ Config: config, DoozerConn: skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log), Log: config.Log, servicePools: map[string]*servicePool{}, } client.Log.Item(config) client.DoozerConn.Connect() client.instanceMonitor = NewInstanceMonitor(client.DoozerConn) return client }
func NewClient(config *skynet.ClientConfig) *Client { if config.Log == nil { config.Log = skynet.NewConsoleLogger("skynet", os.Stderr) } if config.MaxConnectionsToInstance == 0 { panic("must have at least one connection allowed to an instance") } client := &Client{ Config: config, DoozerConn: skynet.NewDoozerConnectionFromConfig(*config.DoozerConfig, config.Log), Log: config.Log, servicePools: map[string]*servicePool{}, } client.Log.Item(config) client.DoozerConn.Connect() client.instanceMonitor = NewInstanceMonitor(client.DoozerConn) return client }