]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: server: use states instead of flags to store the server state
authorWilly Tarreau <w@1wt.eu>
Tue, 13 May 2014 21:41:20 +0000 (23:41 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 22 May 2014 09:27:00 +0000 (11:27 +0200)
commit892337c8e13359bb5c987f7d6295d5d4e0066bcf
tree5ce1c7e94d6ebbdf9b9c519e63e432c14236c4f1
parent2012521d7bb417b9048b4f15df0dd9d8178c46e4
MAJOR: server: use states instead of flags to store the server state

Servers used to have 3 flags to store a state, now they have 4 states
instead. This avoids lots of confusion for the 4 remaining undefined
states.

The encoding from the previous to the new states can be represented
this way :

  SRV_STF_RUNNING
   |  SRV_STF_GOINGDOWN
   |   |  SRV_STF_WARMINGUP
   |   |   |
   0   x   x     SRV_ST_STOPPED
   1   0   0     SRV_ST_RUNNING
   1   0   1     SRV_ST_STARTING
   1   1   x     SRV_ST_STOPPING

Note that the case where all bits were set used to exist and was randomly
dealt with. For example, the task was not stopped, the throttle value was
still updated and reported in the stats and in the http_server_state header.
It was the same if the server was stopped by the agent or for maintenance.

It's worth noting that the internal function names are still quite confusing.
12 files changed:
include/proto/backend.h
include/types/server.h
src/backend.c
src/cfgparse.c
src/checks.c
src/dumpstats.c
src/haproxy.c
src/lb_map.c
src/proto_http.c
src/queue.c
src/server.c
src/session.c