diff --git a/include/proto/connection.h b/include/proto/connection.h index 0236d95e4..b0596a845 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -405,12 +405,6 @@ static inline void set_target_applet(struct target *dest, struct si_applet *a) dest->ptr.a = a; } -static inline void set_target_task(struct target *dest, struct task *t) -{ - dest->type = TARG_TYPE_TASK; - dest->ptr.t = t; -} - static inline struct target *copy_target(struct target *dest, struct target *src) { *dest = *src; diff --git a/include/proto/stream_interface.h b/include/proto/stream_interface.h index 9cc39f53f..7c9595a1f 100644 --- a/include/proto/stream_interface.h +++ b/include/proto/stream_interface.h @@ -41,14 +41,11 @@ int stream_int_shutw(struct stream_interface *si); void stream_sock_read0(struct stream_interface *si); extern struct si_ops si_embedded_ops; -extern struct si_ops si_task_ops; extern struct si_ops si_conn_ops; extern struct data_cb si_conn_cb; struct task *stream_int_register_handler(struct stream_interface *si, struct si_applet *app); -struct task *stream_int_register_handler_task(struct stream_interface *si, - struct task *(*fct)(struct task *)); void stream_int_unregister_handler(struct stream_interface *si); static inline const struct protocol *si_ctrl(struct stream_interface *si) @@ -74,12 +71,6 @@ static inline void si_prepare_embedded(struct stream_interface *si) conn_prepare(si->conn, NULL, NULL, NULL, si); } -static inline void si_prepare_task(struct stream_interface *si) -{ - si->ops = &si_task_ops; - conn_prepare(si->conn, NULL, NULL, NULL, si); -} - /* Sends a shutr to the connection using the data layer */ static inline void si_shutr(struct stream_interface *si) { diff --git a/include/types/connection.h b/include/types/connection.h index b828ffacc..57e9fea5a 100644 --- a/include/types/connection.h +++ b/include/types/connection.h @@ -148,7 +148,6 @@ enum { TARG_TYPE_PROXY, /* target is a proxy ; use address with the proxy's settings */ TARG_TYPE_SERVER, /* target is a server ; use address with server's and its proxy's settings */ TARG_TYPE_APPLET, /* target is an applet ; use only the applet */ - TARG_TYPE_TASK, /* target is a task running an external applet */ }; @@ -193,7 +192,6 @@ struct target { struct proxy *p; /* when type is TARG_TYPE_PROXY */ struct server *s; /* when type is TARG_TYPE_SERVER */ struct si_applet *a; /* when type is TARG_TYPE_APPLET */ - struct task *t; /* when type is TARG_TYPE_TASK */ struct listener *l; /* when type is TARG_TYPE_CLIENT */ } ptr; } __attribute__((packed)); diff --git a/src/stream_interface.c b/src/stream_interface.c index 1834b627b..bcedcb095 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -36,7 +36,6 @@ #include /* socket functions used when running a stream interface as a task */ -static void stream_int_update(struct stream_interface *si); static void stream_int_update_embedded(struct stream_interface *si); static void stream_int_chk_rcv(struct stream_interface *si); static void stream_int_chk_snd(struct stream_interface *si); @@ -54,13 +53,6 @@ struct si_ops si_embedded_ops = { .chk_snd = stream_int_chk_snd, }; -/* stream-interface operations for external tasks */ -struct si_ops si_task_ops = { - .update = stream_int_update, - .chk_rcv = stream_int_chk_rcv, - .chk_snd = stream_int_chk_snd, -}; - /* stream-interface operations for connections */ struct si_ops si_conn_ops = { .update = stream_int_update_conn, @@ -126,17 +118,6 @@ void stream_int_retnclose(struct stream_interface *si, const struct chunk *msg) channel_shutr_now(si->ob); } -/* default update function for scheduled tasks, not used for embedded tasks */ -static void stream_int_update(struct stream_interface *si) -{ - DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n", - __FUNCTION__, - si, si->state, si->ib->flags, si->ob->flags); - - if (!(si->flags & SI_FL_DONT_WAKE) && si->owner) - task_wakeup(si->owner, TASK_WOKEN_IO); -} - /* default update function for embedded tasks, to be used at the end of the i/o handler */ static void stream_int_update_embedded(struct stream_interface *si) { @@ -426,56 +407,17 @@ struct task *stream_int_register_handler(struct stream_interface *si, struct si_ si_prepare_embedded(si); set_target_applet(&si->conn->target, app); - si->release = app->release; + si->release = app->release; si->flags |= SI_FL_WAIT_DATA; return si->owner; } -/* Register a function to handle a stream_interface as a standalone task. The - * new task itself is returned and is assigned as si->owner. The stream_interface - * pointer will be pointed to by the task's context. The handler can be detached - * by using stream_int_unregister_handler(). - * FIXME: the code should be updated to ensure that we don't change si->owner - * anymore as this is not needed. However, process_session still relies on it. - */ -struct task *stream_int_register_handler_task(struct stream_interface *si, - struct task *(*fct)(struct task *)) -{ - struct task *t; - - DPRINTF(stderr, "registering handler %p for si %p (was %p)\n", fct, si, si->owner); - - si_prepare_task(si); - clear_target(&si->conn->target); - si->release = NULL; - si->flags |= SI_FL_WAIT_DATA; - - t = task_new(); - si->owner = t; - if (!t) - return t; - - set_target_task(&si->conn->target, t); - - t->process = fct; - t->context = si; - task_wakeup(si->owner, TASK_WOKEN_INIT); - - return t; -} - /* Unregister a stream interface handler. This must be called by the handler task - * itself when it detects that it is in the SI_ST_DIS state. This function can - * both detach standalone handlers and embedded handlers. + * itself when it detects that it is in the SI_ST_DIS state. */ void stream_int_unregister_handler(struct stream_interface *si) { - if (si->conn->target.type == TARG_TYPE_TASK) { - /* external handler : kill the task */ - task_delete(si->conn->target.ptr.t); - task_free(si->conn->target.ptr.t); - } - si->release = NULL; + si->release = NULL; si->owner = NULL; clear_target(&si->conn->target); }