if (!TEST_ptr(pktsplitbio))
goto err;
cbio = BIO_push(pktsplitbio, cbio);
+
+ pktsplitbio = BIO_new(bio_f_pkt_split_dgram_filter());
+ if (!TEST_ptr(pktsplitbio))
+ goto err;
+ sbio = BIO_push(pktsplitbio, sbio);
}
if ((flags & QTEST_FLAG_NOISE) != 0) {
if (!TEST_ptr(noisebio))
goto err;
cbio = BIO_push(noisebio, cbio);
+
+ noisebio = BIO_new(bio_f_noisy_dgram_filter());
+
+ if (!TEST_ptr(noisebio))
+ goto err;
+ sbio = BIO_push(noisebio, sbio);
}
SSL_set_bio(*cssl, cbio, cbio);
err:
SSL_CTX_free(tserver_args.ctx);
BIO_ADDR_free(peeraddr);
- BIO_free(cbio);
+ BIO_free_all(cbio);
BIO_free(fisbio);
- BIO_free(sbio);
+ BIO_free_all(sbio);
SSL_free(*cssl);
*cssl = NULL;
ossl_quic_tserver_free(*qtserv);
}
#endif
-static int wait_for_timeout(SSL *s, QUIC_TSERVER *qtserv)
+int qtest_wait_for_timeout(SSL *s, QUIC_TSERVER *qtserv)
{
struct timeval tv;
OSSL_TIME ctimeout, stimeout, mintimeout, now;
int cinf;
/* We don't need to wait in blocking mode */
- if (s == NULL || qtserv == NULL)
+ if (s == NULL || SSL_get_blocking_mode(s))
return 1;
/* Don't wait if either BIO has data waiting */
}
}
- if (!clienterr && retc <= 0)
+ qtest_add_time(1);
+ if (clientssl != NULL)
SSL_handle_events(clientssl);
+ if (qtserv != NULL)
+ ossl_quic_tserver_tick(qtserv);
if (!servererr && rets <= 0) {
- qtest_add_time(1);
- ossl_quic_tserver_tick(qtserv);
servererr = ossl_quic_tserver_is_term_any(qtserv);
if (!servererr)
rets = ossl_quic_tserver_is_handshake_confirmed(qtserv);
goto err;
}
- if (!wait_for_timeout(clientssl, qtserv))
- goto err;
+ if ((retc <= 0 && !clienterr) || (rets <= 0 && !servererr)) {
+ if (!qtest_wait_for_timeout(clientssl, qtserv))
+ goto err;
+ }
} while ((retc <= 0 && !clienterr)
|| (rets <= 0 && !servererr
#if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
*/
int qtest_create_quic_connection(QUIC_TSERVER *qtserv, SSL *clientssl);
+/*
+ * Check if both client and server have no data to read and are waiting on a
+ * timeout. If so, wait until the timeout has expired.
+ */
+int qtest_wait_for_timeout(SSL *s, QUIC_TSERVER *qtserv);
+
/*
* Same as qtest_create_quic_connection but will stop (successfully) if the
* clientssl indicates SSL_ERROR_WANT_XXX as specified by |wanterr|
if (*stream != NULL) {
if (SSL_read_ex(*stream, buf, buflen, readbytes))
return 1;
- if (SSL_get_error(*stream, 0) != SSL_ERROR_WANT_READ)
+ if (!TEST_int_eq(SSL_get_error(*stream, 0), SSL_ERROR_WANT_READ))
return 0;
}
ossl_quic_tserver_tick(qtserv);
qtest_add_time(1);
+ qtest_wait_for_timeout(clientquic, qtserv);
}
+ TEST_error("No progress made");
return 0;
}
/* We just do this in a loop with a sleep for simplicity */
for (abortctr = 0; abortctr < MAX_LOOPS; abortctr++) {
- if (ossl_quic_tserver_read(qtserv, sid, buf, buflen, readbytes))
+ if (ossl_quic_tserver_read(qtserv, sid, buf, buflen, readbytes)
+ && *readbytes > 1)
return 1;
ossl_quic_tserver_tick(qtserv);
SSL_handle_events(clientquic);
qtest_add_time(1);
+ qtest_wait_for_timeout(clientquic, qtserv);
}
+ TEST_error("No progress made");
return 0;
}