Moves the LAN event handler after the router is created.

Fixes #3680
pull/3682/head
James Phillips 7 years ago
parent ec24e9f5fc
commit f19ba41144
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11

@ -131,10 +131,7 @@ func NewClientLogger(config *Config, logger *log.Logger) (*Client, error) {
shutdownCh: make(chan struct{}),
}
// Start lan event handlers before lan Serf setup to prevent deadlock
go c.lanEventHandler()
// Initialize the lan Serf
// Initialize the LAN Serf
c.serf, err = c.setupSerf(config.SerfLANConfig,
c.eventCh, serfLANSnapshot)
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)
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
}

Loading…
Cancel
Save