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 }
// 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 (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 }