[OPTIM] session: don't recheck analysers when buffer flags have not changed

Analysers were re-evaluated when some flags were still present in the
buffers, even if they had not changed since previous pass, resulting
in a waste of CPU cycles.

Ensuring that the flags have changed has saved some useless calls :

  function            min calls per session (before -> after)

  http_request_forward_body       5 -> 4
  http_response_forward_body      3 -> 2
  http_sync_req_state            10 -> 8
  http_sync_res_state             8 -> 6
  http_resync_states              8 -> 6
diff --git a/src/session.c b/src/session.c
index 9beb06c..c34ed9f 100644
--- a/src/session.c
+++ b/src/session.c
@@ -1214,8 +1214,8 @@
 	s->req->flags &= ~BF_READ_NOEXP;
 
 	/* Keep a copy of req/rep flags so that we can detect shutdowns */
-	rqf_last = s->req->flags;
-	rpf_last = s->rep->flags;
+	rqf_last = s->req->flags & ~BF_MASK_ANALYSER;
+	rpf_last = s->rep->flags & ~BF_MASK_ANALYSER;
 
 	/* we don't want the stream interface functions to recursively wake us up */
 	if (s->req->prod->owner == t)
@@ -1364,7 +1364,7 @@
 
  resync_request:
 	/* Analyse request */
-	if ((s->req->flags & BF_MASK_ANALYSER) ||
+	if (((s->req->flags & ~rqf_last) & BF_MASK_ANALYSER) ||
 	    ((s->req->flags ^ rqf_last) & BF_MASK_STATIC) ||
 	    s->si[0].state != rq_prod_last ||
 	    s->si[1].state != rq_cons_last) {
@@ -1537,7 +1537,7 @@
 			goto resync_response;
 		}
 	}
-	else if ((s->rep->flags & BF_MASK_ANALYSER) ||
+	else if (((s->rep->flags & ~rpf_last) & BF_MASK_ANALYSER) ||
 		 (s->rep->flags ^ rpf_last) & BF_MASK_STATIC ||
 		 s->si[0].state != rp_cons_last ||
 		 s->si[1].state != rp_prod_last) {
@@ -1627,7 +1627,7 @@
 	 * we're just in a data phase here since it means we have not
 	 * seen any analyser who could set an error status.
 	 */
-	if (!(s->flags & SN_ERR_MASK)) {
+	if (unlikely(!(s->flags & SN_ERR_MASK))) {
 		if (s->req->flags & (BF_READ_ERROR|BF_READ_TIMEOUT|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) {
 			/* Report it if the client got an error or a read timeout expired */
 			s->req->analysers = 0;