summaryrefslogtreecommitdiffstats
path: root/src/plugins/quic/quic.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-07-17 11:02:20 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-07-19 15:40:02 +0000
commit8ac1d6d05f2a0d6759284d4eeb5079644a5c8c86 (patch)
treef5105f805c0c7e1ee57fe8ade14f9292bda253ec /src/plugins/quic/quic.c
parent4f74e9ef34d2bf22c70b78f91613cfd43f9a7bd4 (diff)
session: Use parent_handle instead of transport_opts
Type: feature This is mostly used for quic in the case of a stream creation (i.e. connect on an already established QUIC session). We want do default parent_handle to INVALID to be able to distinguish it from parent_handle = 0 Change-Id: Id5ac0b0155a3c44e51334231b711e4fd87a96a10 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/quic/quic.c')
-rw-r--r--src/plugins/quic/quic.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 39e460e1ac8..1575f2bff5f 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1334,10 +1334,10 @@ allocate_quicly_ctx (application_t * app, u8 is_client)
*****************************************************************************/
static int
-quic_connect_new_stream (session_endpoint_cfg_t * sep)
+quic_connect_new_stream (session_t * quic_session, u32 opaque)
{
uint64_t quic_session_handle;
- session_t *quic_session, *stream_session;
+ session_t *stream_session;
quic_stream_data_t *stream_data;
quicly_stream_t *stream;
quicly_conn_t *conn;
@@ -1347,12 +1347,11 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
int rv;
/* Find base session to which the user want to attach a stream */
- quic_session_handle = sep->transport_opts;
- QUIC_DBG (2, "Opening new stream (qsession %u)", sep->transport_opts);
- quic_session = session_get_from_handle (quic_session_handle);
+ quic_session_handle = session_handle (quic_session);
+ QUIC_DBG (2, "Opening new stream (qsession %u)", quic_session_handle);
- if (quic_session->session_type !=
- session_type_from_proto_and_ip (TRANSPORT_PROTO_QUIC, sep->is_ip4))
+ if (session_type_transport_proto (quic_session->session_type) !=
+ TRANSPORT_PROTO_QUIC)
{
QUIC_DBG (1, "received incompatible session");
return -1;
@@ -1415,7 +1414,7 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
quicly_reset_stream (stream, QUIC_APP_ALLOCATION_ERROR);
session_free_w_fifos (stream_session);
quic_ctx_free (sctx);
- return app_worker_connect_notify (app_wrk, NULL, sep->opaque);
+ return app_worker_connect_notify (app_wrk, NULL, opaque);
}
svm_fifo_add_want_deq_ntf (stream_session->rx_fifo,
@@ -1423,7 +1422,7 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY);
stream_session->session_state = SESSION_STATE_READY;
- if (app_worker_connect_notify (app_wrk, stream_session, sep->opaque))
+ if (app_worker_connect_notify (app_wrk, stream_session, opaque))
{
QUIC_DBG (1, "failed to notify app");
quicly_reset_stream (stream, QUIC_APP_CONNECT_NOTIFY_ERROR);
@@ -1494,9 +1493,12 @@ quic_connect (transport_endpoint_cfg_t * tep)
{
QUIC_DBG (2, "Called quic_connect");
session_endpoint_cfg_t *sep = (session_endpoint_cfg_t *) tep;
+ session_t *quic_session;
sep = (session_endpoint_cfg_t *) tep;
- if (sep->port == 0) /* TODO add mask on transport_opts */
- return quic_connect_new_stream (sep);
+
+ quic_session = session_get_from_handle_if_valid (sep->parent_handle);
+ if (quic_session)
+ return quic_connect_new_stream (quic_session, sep->opaque);
else
return quic_connect_new_connection (sep);
}