updateServices brings the services for a vserver up or down based on the state of the vserver and the health of each service.
(ip seesaw.IP)
| 1192 | // updateServices brings the services for a vserver up or down based on the |
| 1193 | // state of the vserver and the health of each service. |
| 1194 | func (v *vserver) updateServices(ip seesaw.IP) { |
| 1195 | for _, s := range v.services { |
| 1196 | if !s.ip.Equal(ip) { |
| 1197 | continue |
| 1198 | } |
| 1199 | if !v.active[ip] { |
| 1200 | if s.active { |
| 1201 | s.down() |
| 1202 | } |
| 1203 | continue |
| 1204 | } |
| 1205 | switch { |
| 1206 | case !s.healthy && s.active: |
| 1207 | s.down() |
| 1208 | case s.healthy && !s.active: |
| 1209 | s.up() |
| 1210 | } |
| 1211 | } |
| 1212 | } |
| 1213 | |
| 1214 | // up brings up all healthy services for an IP address for a vserver, then |
| 1215 | // brings up the IP address. |