MEDIUM: stream: return the stream upon accept()
The function was called stream_accept_session(), let's rename it
stream_new() and make it return the newly allocated pointer. It's
more convenient for some callers who need it.
diff --git a/src/session.c b/src/session.c
index 790f89a..6dcbadb 100644
--- a/src/session.c
+++ b/src/session.c
@@ -195,9 +195,8 @@
/* OK let's complete stream initialization since there is no handshake */
cli_conn->flags |= CO_FL_CONNECTED;
- ret = stream_accept_session(sess, t);
- if (ret > 0)
- return ret;
+ if (stream_new(sess, t))
+ return 1;
task_free(t);
out_free_sess:
@@ -342,7 +341,7 @@
struct task *task = conn->owner;
struct session *sess = task->context;
- if (!(conn->flags & CO_FL_ERROR) && (stream_accept_session(sess, task) > 0)) {
+ if (!(conn->flags & CO_FL_ERROR) && (stream_new(sess, task) != NULL)) {
conn->flags &= ~CO_FL_INIT_DATA;
return 0;
}