[MEDIUM] implement the slowstart parameter for servers

The new 'slowstart' parameter for a server accepts a value in
milliseconds which indicates after how long a server which has
just come back up will run at full speed. The speed grows
linearly from 0 to 100% during this time. The limitation applies
to two parameters :

  - maxconn: the number of connections accepted by the server
    will grow from 1 to 100% of the usual dynamic limit defined
    by (minconn,maxconn,fullconn).

  - weight: when the backend uses a dynamic weighted algorithm,
    the weight grows linearly from 1 to 100%. In this case, the
    weight is updated at every health-check. For this reason, it
    is important that the 'inter' parameter is smaller than the
    'slowstart', in order to maximize the number of steps.

The slowstart never applies when haproxy starts, otherwise it
would cause trouble to running servers. It only applies when
a server has been previously seen as failed.
diff --git a/src/checks.c b/src/checks.c
index d3aa6c8..c72b55f 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -530,6 +530,25 @@
 		if ((s->result & (SRV_CHK_ERROR|SRV_CHK_RUNNING)) == SRV_CHK_RUNNING) { /* good server detected */
 			//fprintf(stderr, "process_chk: 9\n");
 
+			if (s->state & SRV_WARMINGUP) {
+				if (now.tv_sec < s->last_change || now.tv_sec >= s->last_change + s->slowstart) {
+					s->state &= ~SRV_WARMINGUP;
+					if (s->proxy->lbprm.algo & BE_LB_PROP_DYN)
+						s->eweight = s->uweight * BE_WEIGHT_SCALE;
+					if (s->proxy->lbprm.update_server_eweight)
+						s->proxy->lbprm.update_server_eweight(s);
+				}
+				else if (s->proxy->lbprm.algo & BE_LB_PROP_DYN) {
+					/* for dynamic algorithms, let's update the weight */
+					s->eweight = BE_WEIGHT_SCALE * (now.tv_sec - s->last_change) / s->slowstart;
+					s->eweight *= s->uweight;
+					if (s->proxy->lbprm.update_server_eweight)
+						s->proxy->lbprm.update_server_eweight(s);
+				}
+				/* probably that we can refill this server with a bit more connections */
+				check_for_pending(s);
+			}
+
 			/* we may have to add/remove this server from the LB group */
 			if ((s->state & SRV_RUNNING) && (s->proxy->options & PR_O_DISABLE404)) {
 				if ((s->state & SRV_GOINGDOWN) &&
@@ -598,6 +617,17 @@
 
 					s->last_change = now.tv_sec;
 					s->state |= SRV_RUNNING;
+					if (s->slowstart > 0) {
+						s->state |= SRV_WARMINGUP;
+						if (s->proxy->lbprm.algo & BE_LB_PROP_DYN) {
+							/* For dynamic algorithms, start at the first step of the weight,
+							 * without multiplying by BE_WEIGHT_SCALE.
+							 */
+							s->eweight = s->uweight;
+							if (s->proxy->lbprm.update_server_eweight)
+								s->proxy->lbprm.update_server_eweight(s);
+						}
+					}
 					s->proxy->lbprm.set_server_status_up(s);
 
 					/* check if we can handle some connections queued at the proxy. We