MEDIUM: applet: centralize the call to si_applet_done() in the I/O handler

It's much easier to centralize this call into the I/O handler than to
do it everywhere with the risk to miss it. Applets are not allowed to
unregister themselves anyway so their SI is still present and it is
possible to update all the context.
diff --git a/src/applet.c b/src/applet.c
index 3aa67e7..37303f7 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -38,6 +38,6 @@
 		}
 
 		curr->applet->fct(curr);
-		/* must not dereference curr nor si now because it might have been freed */
+		si_applet_done(si);
 	}
 }
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 5a890e9..c835b1e 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -2429,13 +2429,6 @@
 	}
 
  out:
-	/* update all other flags and resync with the other side */
-	si_applet_done(si);
-
-	/* we don't want to expire timeouts while we're processing requests */
-	si_ic(si)->rex = TICK_ETERNITY;
-	si_oc(si)->wex = TICK_ETERNITY;
-
 	DPRINTF(stderr, "%s@%d: st=%d, rqf=%x, rpf=%x, rqh=%d, rqs=%d, rh=%d, rs=%d\n",
 		__FUNCTION__, __LINE__,
 		si->state, req->flags, res->flags, req->buf->i, req->buf->o, res->buf->i, res->buf->o);
@@ -4961,14 +4954,8 @@
 			res->flags |= CF_READ_NULL;
 		}
 	}
-
  out:
-	/* update all other flags and resync with the other side */
-	si_applet_done(si);
-
-	/* we don't want to expire timeouts while we're processing requests */
-	si_ic(si)->rex = TICK_ETERNITY;
-	si_oc(si)->wex = TICK_ETERNITY;
+	/* just to make gcc happy */ ;
 }
 
 
diff --git a/src/hlua.c b/src/hlua.c
index fb006e6..37fce89 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -1446,11 +1446,11 @@
 		si_ic(si)->flags |= CF_READ_NULL;
 		hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
 		hlua_com_wake(&appctx->ctx.hlua.wake_on_write);
-		goto leave;
+		return;
 	}
 
 	if (!(c->flags & CO_FL_CONNECTED))
-		goto leave;
+		return;
 
 	/* This function is called after the connect. */
 	appctx->ctx.hlua.connected = 1;
@@ -1462,9 +1462,6 @@
 	/* Wake the tasks which wants to read if the buffer contains data. */
 	if (channel_is_empty(si_ic(si)))
 		hlua_com_wake(&appctx->ctx.hlua.wake_on_read);
-
- leave:
-	si_applet_done(si);
 }
 
 /* This function is called when the "struct stream" is destroyed.
diff --git a/src/peers.c b/src/peers.c
index 97a8728..5b6d817 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -1043,11 +1043,7 @@
 		}
 	}
 out:
-	si_applet_done(si);
 	si_oc(si)->flags |= CF_READ_DONTWAIT;
-	/* we don't want to expire timeouts while we're processing requests */
-	si_ic(si)->rex = TICK_ETERNITY;
-	si_oc(si)->wex = TICK_ETERNITY;
 	return;
 full:
 	si->flags |= SI_FL_WAIT_ROOM;