Skip to content

Commit

Permalink
ais: properly start listening on all extra pub interfaces
Browse files Browse the repository at this point in the history
Signed-off-by: Janusz Marcinkiewicz <[email protected]>
  • Loading branch information
VirrageS committed Jul 26, 2024
1 parent 0bbdc86 commit dc551e6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
18 changes: 12 additions & 6 deletions ais/htrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ func (h *htrun) initSnode(config *cmn.Config) {
}

// 1. pub net

// the "hostname" field can be a single IP address or DNS hostname;
// it can also be a comma-separated list of IP addresses (or DNS hostnames), in which case the function
// returns pub = list[0] and extra = list[1:]
pub, extra := multihome(config.HostNet.Hostname)

if k8s.IsK8s() && config.HostNet.Hostname != "" {
Expand Down Expand Up @@ -508,12 +512,14 @@ func (h *htrun) run(config *cmn.Config) error {
if h.pubAddrAny(config) {
ep = ":" + h.si.PubNet.Port
} else if len(h.si.PubExtra) > 0 {
pubAddr2 := h.si.PubExtra[0]
debug.Assert(pubAddr2.Port == h.si.PubNet.Port)
g.netServ.pub2 = &netServer{muxers: g.netServ.pub.muxers, sndRcvBufSize: g.netServ.pub.sndRcvBufSize}
go func() {
_ = g.netServ.pub2.listen(pubAddr2.TCPEndpoint(), logger, tlsConf, config)
}()
for _, pubExtra := range h.si.PubExtra {
debug.Assert(pubExtra.Port == h.si.PubNet.Port, "expecting the same TCP port for all multi-home interfaces")
server := &netServer{muxers: g.netServ.pub.muxers, sndRcvBufSize: g.netServ.pub.sndRcvBufSize}
go func() {
_ = server.listen(pubExtra.TCPEndpoint(), logger, tlsConf, config)
}()
g.netServ.pubExtra = append(g.netServ.pubExtra, server)
}
}

return g.netServ.pub.listen(ep, logger, tlsConf, config) // stay here
Expand Down
12 changes: 6 additions & 6 deletions ais/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

type global struct {
netServ struct {
pub *netServer
control *netServer
data *netServer
pub2 *netServer
pub *netServer
pubExtra []*netServer
control *netServer
data *netServer
}
client struct {
control *http.Client // http client for intra-cluster comm
Expand Down Expand Up @@ -94,8 +94,8 @@ func initDataClient(config *cmn.Config) {
func shuthttp() {
config := cmn.GCO.Get()
g.netServ.pub.shutdown(config)
if g.netServ.pub2 != nil {
g.netServ.pub2.shutdown(config)
for _, server := range g.netServ.pubExtra {
server.shutdown(config)
}
if config.HostNet.UseIntraControl {
g.netServ.control.shutdown(config)
Expand Down

0 comments on commit dc551e6

Please sign in to comment.