Skip to content

Commit

Permalink
consul: Defer serf handler until initialized. Fixes #254.
Browse files Browse the repository at this point in the history
  • Loading branch information
armon committed Jul 22, 2014
1 parent ac745b1 commit ce9de56
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions consul/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,14 @@ func NewServer(config *Config) (*Server, error) {
return nil, fmt.Errorf("Failed to start Raft: %v", err)
}

// Start the Serf listeners to prevent a deadlock
go s.lanEventHandler()
go s.wanEventHandler()

// Initialize the lan Serf
s.serfLAN, err = s.setupSerf(config.SerfLANConfig,
s.eventChLAN, serfLANSnapshot, false)
if err != nil {
s.Shutdown()
return nil, fmt.Errorf("Failed to start lan serf: %v", err)
}
go s.lanEventHandler()

// Initialize the wan Serf
s.serfWAN, err = s.setupSerf(config.SerfWANConfig,
Expand All @@ -206,6 +203,7 @@ func NewServer(config *Config) (*Server, error) {
s.Shutdown()
return nil, fmt.Errorf("Failed to start wan serf: %v", err)
}
go s.wanEventHandler()

// Start listening for RPC requests
go s.listen()
Expand Down

0 comments on commit ce9de56

Please sign in to comment.