MEDIUM: stream: make stream_new() allocate its own task
authorWilly Tarreau <w@1wt.eu>
Mon, 28 Aug 2017 14:22:54 +0000 (16:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Aug 2017 05:05:04 +0000 (07:05 +0200)
commit87787acf724eeaf413393b5fce0047ad74356815
treee92f887b36b2298f5fd05ef890bb1363077065ce
parent8e3c6ce75a4f4b61e01ddb72d278ad447dbc1ae7
MEDIUM: stream: make stream_new() allocate its own task

Currently a task is allocated in session_new() and serves two purposes :
  - either the handshake is complete and it is offered to the stream via
    the second arg of stream_new()

  - or the handshake is not complete and it's diverted to be used as a
    timeout handler for the embryonic session and repurposed once we land
    into conn_complete_session()

Furthermore, the task's process() function was taken from the listener's
handler in conn_complete_session() prior to being replaced by a call to
stream_new(). This will become a serious mess with the mux.

Since it's impossible to have a stream without a task, this patch removes
the second arg from stream_new() and make this function allocate its own
task. In session_accept_fd(), we now only allocate the task if needed for
the embryonic session and delete it later.
include/proto/stream.h
src/flt_spoe.c
src/hlua.c
src/peers.c
src/session.c
src/stream.c