Skip to content

Commit 517fc50

Browse files
hentereveresio
authored andcommitted
bugfix for external server mapping conflict with bootstrap server
1 parent fea222c commit 517fc50

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

proxy/proxy.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ func NewListeners(cfg *config.Config) (*Listeners, error) {
7171
brokerToListenerConfig[v.BrokerAddress] = v
7272
}
7373

74+
for _, v := range cfg.Proxy.BootstrapServers {
75+
//to avoid external server map override by bootstrap server
76+
if _, ok := brokerToListenerConfig[v.BrokerAddress]; ok {
77+
continue
78+
}
79+
logrus.Infof("Bootstrap server %s advertised as %s", v.BrokerAddress, v.AdvertisedAddress)
80+
brokerToListenerConfig[v.BrokerAddress] = v
81+
}
82+
7483
return &Listeners{
7584
defaultListenerIP: defaultListenerIP,
7685
connSrc: make(chan Conn, 1),
@@ -132,7 +141,6 @@ func (p *Listeners) ListenInstances(cfgs []config.ListenerConfig) (<-chan Conn,
132141
if err != nil {
133142
return nil, err
134143
}
135-
p.brokerToListenerConfig[v.BrokerAddress] = v
136144
}
137145
return p.connSrc, nil
138146
}
@@ -160,6 +168,6 @@ func listenInstance(dst chan<- Conn, cfg config.ListenerConfig, opts TCPConnOpti
160168
}
161169
})
162170

163-
logrus.Infof("Listening on %s (%s) for remote %s advertised as %s", cfg.ListenerAddress, l.Addr().String(), cfg.BrokerAddress, cfg.AdvertisedAddress)
171+
logrus.Infof("Listening on %s (%s) for remote %s", cfg.ListenerAddress, l.Addr().String(), cfg.BrokerAddress)
164172
return l, nil
165173
}

0 commit comments

Comments
 (0)