From 8d58dc40a0a20f0bb3047a7a7ae6d47b6b5879f9 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 27 Apr 2021 17:03:24 -0700 Subject: [PATCH] hsa: fix quic vcl test Type: fix Signed-off-by: Florin Coras Change-Id: I9a4bf384be65ba8b868d1172c7b6e00ae959601e --- src/plugins/hs_apps/vcl/vcl_test_protos.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/plugins/hs_apps/vcl/vcl_test_protos.c b/src/plugins/hs_apps/vcl/vcl_test_protos.c index d2388224d12..45fff0fa1a1 100644 --- a/src/plugins/hs_apps/vcl/vcl_test_protos.c +++ b/src/plugins/hs_apps/vcl/vcl_test_protos.c @@ -279,7 +279,7 @@ static int vt_tls_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) { vcl_test_main_t *vt = &vcl_test_main; - uint32_t flags, flen; + uint32_t flags, flen, ckp_len; int rv; ts->fd = vppcom_session_create (VPPCOM_PROTO_TLS, 0 /* is_nonblocking */); @@ -289,7 +289,7 @@ vt_tls_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) return ts->fd; } - uint32_t ckp_len = sizeof (vt->ckpair_index); + ckp_len = sizeof (vt->ckpair_index); vppcom_session_attr (ts->fd, VPPCOM_ATTR_SET_CKPAIR, &vt->ckpair_index, &ckp_len); @@ -384,7 +384,7 @@ static int vt_dtls_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) { vcl_test_main_t *vt = &vcl_test_main; - uint32_t flags, flen; + uint32_t flags, flen, ckp_len; int rv; ts->fd = vppcom_session_create (VPPCOM_PROTO_DTLS, 0 /* is_nonblocking */); @@ -394,7 +394,7 @@ vt_dtls_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) return ts->fd; } - uint32_t ckp_len = sizeof (vt->ckpair_index); + ckp_len = sizeof (vt->ckpair_index); vppcom_session_attr (ts->fd, VPPCOM_ATTR_SET_CKPAIR, &vt->ckpair_index, &ckp_len); @@ -494,7 +494,7 @@ static int vt_quic_maybe_init_wrk (vcl_test_main_t *vt, vcl_test_wrk_t *wrk, vppcom_endpt_t *endpt) { - uint32_t size, i, flags, flen; + uint32_t size, i, flags, flen, ckp_len; vcl_test_session_t *tq; int rv; @@ -532,6 +532,10 @@ vt_quic_maybe_init_wrk (vcl_test_main_t *vt, vcl_test_wrk_t *wrk, return tq->fd; } + ckp_len = sizeof (vt->ckpair_index); + vppcom_session_attr (tq->fd, VPPCOM_ATTR_SET_CKPAIR, &vt->ckpair_index, + &ckp_len); + /* Connect is blocking */ rv = vppcom_session_connect (tq->fd, endpt); if (rv < 0) @@ -553,9 +557,9 @@ static int vt_quic_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) { vcl_test_main_t *vt = &vcl_test_main; + uint32_t wrk_index, flags, flen; vcl_test_session_t *tq; vcl_test_wrk_t *wrk; - uint32_t wrk_index; int rv; wrk_index = vcl_test_worker_index (); @@ -564,7 +568,7 @@ vt_quic_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) /* Make sure qsessions are initialized */ vt_quic_maybe_init_wrk (vt, wrk, endpt); - ts->fd = vppcom_session_create (VPPCOM_PROTO_QUIC, 1 /* is_nonblocking */); + ts->fd = vppcom_session_create (VPPCOM_PROTO_QUIC, 0 /* is_nonblocking */); if (ts->fd < 0) { vterr ("vppcom_session_create()", ts->fd); @@ -581,7 +585,15 @@ vt_quic_connect (vcl_test_session_t *ts, vppcom_endpt_t *endpt) return rv; } - vtinf ("Test session %d (fd %d) connected.", ts->session_index, ts->fd); + flags = O_NONBLOCK; + flen = sizeof (flags); + vppcom_session_attr (ts->fd, VPPCOM_ATTR_SET_FLAGS, &flags, &flen); + + ts->read = vcl_test_read; + ts->write = vcl_test_write; + + vtinf ("Test (quic stream) session %d (fd %d) connected.", ts->session_index, + ts->fd); return 0; } @@ -593,7 +605,7 @@ vt_quic_listen (vcl_test_session_t *ts, vppcom_endpt_t *endpt) uint32_t ckp_len; int rv; - ts->fd = vppcom_session_create (VPPCOM_PROTO_QUIC, 0 /* is_nonblocking */); + ts->fd = vppcom_session_create (VPPCOM_PROTO_QUIC, 1 /* is_nonblocking */); if (ts->fd < 0) { vterr ("vppcom_session_create()", ts->fd); -- 2.16.6