@@ -40,11 +40,13 @@ func (c *clientNative) SyncBackendSrvs(oldEndpoints, newEndpoints *store.PortEnd
4040 newEndpoints .BackendName = oldEndpoints .BackendName
4141 haproxySrvs := newEndpoints .HAProxySrvs
4242 newAddresses := newEndpoints .AddrNew
43+ portChanged := newEndpoints .Port != oldEndpoints .Port
4344 // Disable stale entries from HAProxySrvs
4445 // and provide list of Disabled Srvs
4546 var disabled []* store.HAProxySrv
4647 var errors utils.Errors
4748 for i , srv := range haproxySrvs {
49+ srv .Modified = portChanged || srv .Modified
4850 if _ , ok := newAddresses [srv .Address ]; ok {
4951 delete (newAddresses , srv .Address )
5052 } else {
@@ -76,7 +78,7 @@ func (c *clientNative) SyncBackendSrvs(oldEndpoints, newEndpoints *store.PortEnd
7678 stateErr = c .SetServerState (newEndpoints .BackendName , srv .Name , "maint" )
7779 } else {
7880 // logger.Tracef("server '%s/%s' changed status to %v", newEndpoints.BackendName, srv.Name, "ready")
79- addrErr = c .SetServerAddr (newEndpoints .BackendName , srv .Name , srv .Address , 0 )
81+ addrErr = c .SetServerAddr (newEndpoints .BackendName , srv .Name , srv .Address , int ( newEndpoints . Port ) )
8082 stateErr = c .SetServerState (newEndpoints .BackendName , srv .Name , "ready" )
8183 }
8284 if addrErr != nil || stateErr != nil {
0 commit comments