Moves the LAN event handler after the router is created.

Fixes #3680
This commit is contained in:
James Phillips 2017-11-10 12:26:48 -08:00
parent 0759df74e0
commit 8210523b1b
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 5 additions and 4 deletions

View File

@ -131,10 +131,7 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) {
shutdownCh: make(chan struct{}), shutdownCh: make(chan struct{}),
} }
// Start lan event handlers before lan Serf setup to prevent deadlock // Initialize the LAN Serf
go c.lanEventHandler()
// Initialize the lan Serf
c.serf, err = c.setupSerf(config.SerfLANConfig, c.serf, err = c.setupSerf(config.SerfLANConfig,
c.eventCh, serfLANSnapshot) c.eventCh, serfLANSnapshot)
if err != nil { if err != nil {
@ -146,6 +143,10 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) {
c.routers = router.New(c.logger, c.shutdownCh, c.serf, c.connPool) c.routers = router.New(c.logger, c.shutdownCh, c.serf, c.connPool)
go c.routers.Start() go c.routers.Start()
// Start LAN event handlers after the router is complete since the event
// handlers depend on the router and the router depends on Serf.
go c.lanEventHandler()
return c, nil return c, nil
} }