Manages segments list via a pointer.

This commit is contained in:
James Phillips 2017-09-07 16:20:25 -07:00
parent 3b1eebd502
commit c277a42504
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
2 changed files with 4 additions and 4 deletions

View File

@ -783,10 +783,10 @@ func (a *Agent) consulConfig() (*consul.Config, error) {
}
// Setup the serf and memberlist config for any defined network segments.
func (a *Agent) segmentConfig() ([]consul.NetworkSegment, error) {
var segments []consul.NetworkSegment
func (a *Agent) segmentConfig() ([]*consul.NetworkSegment, error) {
config := a.config
var segments []*consul.NetworkSegment
for _, segment := range config.Segments {
serfConf := consul.DefaultConfig().SerfLANConfig
@ -821,7 +821,7 @@ func (a *Agent) segmentConfig() ([]consul.NetworkSegment, error) {
}
}
segments = append(segments, consul.NetworkSegment{
segments = append(segments, &consul.NetworkSegment{
Name: segment.Name,
Bind: serfConf.MemberlistConfig.BindAddr,
Port: segment.Port,

View File

@ -122,7 +122,7 @@ type Config struct {
// (Enterprise-only) Segments is a list of network segments for a server to
// bind on.
Segments []NetworkSegment
Segments []*NetworkSegment
// SerfLANConfig is the configuration for the intra-dc serf
SerfLANConfig *serf.Config