MINOR: task/stream: tasks related to a stream must be init by the caller.

The task_wakeup was called on stream_new, but the task/stream
wasn't fully initialized yet. The task_wakeup must be called
explicitly by the caller once the task/stream is initialized.
This commit is contained in:
Emeric Brun 2017-05-29 15:26:51 +02:00 committed by Willy Tarreau
parent 0194897e54
commit 5f77fef34e
5 changed files with 9 additions and 2 deletions

View File

@ -1960,6 +1960,8 @@ spoe_create_appctx(struct spoe_config *conf)
task_wakeup(SPOE_APPCTX(appctx)->task, TASK_WOKEN_INIT);
LIST_ADDQ(&conf->agent->applets, &SPOE_APPCTX(appctx)->list);
conf->agent->applets_act++;
task_wakeup(task, TASK_WOKEN_INIT);
return appctx;
/* Error unrolling */

View File

@ -2353,6 +2353,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
jobs++;
totalconn++;
task_wakeup(task, TASK_WOKEN_INIT);
/* Return yield waiting for connection. */
return 1;

View File

@ -1835,6 +1835,7 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
totalconn++;
peer->appctx = appctx;
task_wakeup(t, TASK_WOKEN_INIT);
return appctx;
/* Error unrolling */

View File

@ -276,6 +276,7 @@ int session_accept_fd(struct listener *l, int cfd, struct sockaddr_storage *addr
strm->target = sess->listener->default_target;
strm->req.analysers |= sess->listener->analysers;
task_wakeup(t, TASK_WOKEN_INIT);
return 1;
out_free_task:
@ -446,6 +447,7 @@ static int conn_complete_session(struct connection *conn)
strm->req.analysers |= sess->listener->analysers;
conn->flags &= ~CO_FL_INIT_DATA;
task_wakeup(task, TASK_WOKEN_INIT);
return 0;
fail:

View File

@ -239,9 +239,10 @@ struct stream *stream_new(struct session *sess, struct task *t, enum obj_type *o
/* it is important not to call the wakeup function directly but to
* pass through task_wakeup(), because this one knows how to apply
* priorities to tasks.
* priorities to tasks. Using multi thread we must be sure that
* stream is fully initialized before calling task_wakeup. So
* the caller must handle the task_wakeup
*/
task_wakeup(t, TASK_WOKEN_INIT);
return s;
/* Error unrolling */