MEDIUM: connection: use a generic data-layer init() callback

The generic data-layer init callback is now used after the transport
layer is complete and before calling the data layer recv/send callbacks.

This allows the session to switch from the embryonic session data layer
to the complete stream interface data layer, by making conn_session_complete()
the data layer's init callback.

It sill looks awkwards that the init() callback must be used opon error,
but except by adding yet another one, it does not seem to be mergeable
into another function (eg: it should probably not be merged with ->wake
to avoid unneeded calls during the handshake, though semantically that
would make sense).
diff --git a/src/session.c b/src/session.c
index 6209921..a32ec6b 100644
--- a/src/session.c
+++ b/src/session.c
@@ -50,6 +50,7 @@
 struct pool_head *pool2_session;
 struct list sessions;
 
+static int conn_session_complete(struct connection *conn);
 static struct task *expire_mini_session(struct task *t);
 int session_complete(struct session *s);
 
@@ -58,7 +59,7 @@
 	.recv = NULL,
 	.send = NULL,
 	.wake = NULL,
-	.init = NULL,
+	.init = conn_session_complete,
 };
 
 /* This function is called from the protocol layer accept() in order to
@@ -193,7 +194,7 @@
 		t->process = expire_mini_session;
 		t->expire = tick_add_ifset(now_ms, p->timeout.client);
 		task_queue(t);
-		s->si[0].conn.flags |= CO_FL_INIT_SESS;
+		s->si[0].conn.flags |= CO_FL_INIT_DATA;
 		return 1;
 	}
 
@@ -266,12 +267,12 @@
 /* Finish initializing a session from a connection, or kills it if the
  * connection shows and error. Returns <0 if the connection was killed.
  */
-int conn_session_complete(struct connection *conn, int flag)
+static int conn_session_complete(struct connection *conn)
 {
 	struct session *s = conn->owner;
 
 	if (!(conn->flags & CO_FL_ERROR) && (session_complete(s) > 0)) {
-		conn->flags &= ~flag;
+		conn->flags &= ~CO_FL_INIT_DATA;
 		return 0;
 	}