MEDIUM: Set rise and fall of agent checks to 1

This is achieved by moving rise and fall from struct server to struct check.

After this move the behaviour of the primary check, server->check is
unchanged. However, the secondary agent check, server->agent now has
independent rise and fall values each of which are set to 1.

The result is that receiving "fail", "stopped" or "down" just once from the
agent will mark the server as down. And receiving a weight just once will
allow the server to be marked up if its primary check is in good health.

This opens up the scope to allow the rise and fall values of the agent
check to be configurable, however this has not been implemented at this
stage.

Signed-off-by: Simon Horman <horms@verge.net.au>
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 7df7de0..8c289f1 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1328,8 +1328,10 @@
 	defproxy.defsrv.agent.inter = DEF_CHKINTR;
 	defproxy.defsrv.agent.fastinter = 0;
 	defproxy.defsrv.agent.downinter = 0;
-	defproxy.defsrv.rise = DEF_RISETIME;
-	defproxy.defsrv.fall = DEF_FALLTIME;
+	defproxy.defsrv.check.rise = DEF_RISETIME;
+	defproxy.defsrv.check.fall = DEF_FALLTIME;
+	defproxy.defsrv.agent.rise = DEF_AGENT_RISETIME;
+	defproxy.defsrv.agent.fall = DEF_AGENT_FALLTIME;
 	defproxy.defsrv.check.port = 0;
 	defproxy.defsrv.agent.port = 0;
 	defproxy.defsrv.maxqueue = 0;
@@ -4287,8 +4289,6 @@
 			newsrv->agent.inter	= curproxy->defsrv.agent.inter;
 			newsrv->agent.fastinter	= curproxy->defsrv.agent.fastinter;
 			newsrv->agent.downinter	= curproxy->defsrv.agent.downinter;
-			newsrv->rise		= curproxy->defsrv.rise;
-			newsrv->fall		= curproxy->defsrv.fall;
 			newsrv->maxqueue	= curproxy->defsrv.maxqueue;
 			newsrv->minconn		= curproxy->defsrv.minconn;
 			newsrv->maxconn		= curproxy->defsrv.maxconn;
@@ -4303,11 +4303,15 @@
 						= curproxy->defsrv.iweight;
 
 			newsrv->check.status	= HCHK_STATUS_INI;
-			newsrv->check.health	= newsrv->rise;	/* up, but will fall down at first failure */
+			newsrv->check.rise	= curproxy->defsrv.check.rise;
+			newsrv->check.fall	= curproxy->defsrv.check.fall;
+			newsrv->check.health	= newsrv->check.rise;	/* up, but will fall down at first failure */
 			newsrv->check.server	= newsrv;
 
 			newsrv->agent.status	= HCHK_STATUS_INI;
-			newsrv->agent.health	= newsrv->rise;	/* up, but will fall down at first failure */
+			newsrv->agent.rise	= curproxy->defsrv.agent.rise;
+			newsrv->agent.fall	= curproxy->defsrv.agent.fall;
+			newsrv->agent.health	= newsrv->agent.rise;	/* up, but will fall down at first failure */
 			newsrv->agent.server	= newsrv;
 
 			cur_arg = 3;
@@ -4361,8 +4365,8 @@
 					goto out;
 				}
 
-				newsrv->rise = atol(args[cur_arg + 1]);
-				if (newsrv->rise <= 0) {
+				newsrv->check.rise = atol(args[cur_arg + 1]);
+				if (newsrv->check.rise <= 0) {
 					Alert("parsing [%s:%d]: '%s' has to be > 0.\n",
 						file, linenum, args[cur_arg]);
 					err_code |= ERR_ALERT | ERR_FATAL;
@@ -4370,13 +4374,11 @@
 				}
 
 				if (newsrv->check.health)
-					newsrv->check.health = newsrv->rise;
-				if (newsrv->agent.health)
-					newsrv->agent.health = newsrv->rise;
+					newsrv->check.health = newsrv->check.rise;
 				cur_arg += 2;
 			}
 			else if (!strcmp(args[cur_arg], "fall")) {
-				newsrv->fall = atol(args[cur_arg + 1]);
+				newsrv->check.fall = atol(args[cur_arg + 1]);
 
 				if (!*args[cur_arg + 1]) {
 					Alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
@@ -4385,7 +4387,7 @@
 					goto out;
 				}
 
-				if (newsrv->fall <= 0) {
+				if (newsrv->check.fall <= 0) {
 					Alert("parsing [%s:%d]: '%s' has to be > 0.\n",
 						file, linenum, args[cur_arg]);
 					err_code |= ERR_ALERT | ERR_FATAL;