Skip to content

Commit

Permalink
Always tick the QUIC_ENGINE regardless of the state of a connection
Browse files Browse the repository at this point in the history
Just because one connection has not started yet, it does not mean that
we should not tick the QUIC_ENGINE. There may be other connections that do
need ticking.
  • Loading branch information
mattcaswell committed Sep 12, 2024
1 parent 6c7b587 commit 7701ecc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
12 changes: 6 additions & 6 deletions ssl/quic/quic_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,12 +1870,12 @@ void ossl_quic_channel_subtick(QUIC_CHANNEL *ch, QUIC_TICK_RESULT *res,
* - determine the time at which we should next be ticked.
*/

/* Nothing to do yet if connection has not been started. */
if (ch->state == QUIC_CHANNEL_STATE_IDLE)
return;

/* If we are in the TERMINATED state, there is nothing to do. */
if (ossl_quic_channel_is_terminated(ch)) {
/*
* If the connection has not yet started, or we are in the TERMINATED state,
* there is nothing to do.
*/
if (ch->state == QUIC_CHANNEL_STATE_IDLE
|| ossl_quic_channel_is_terminated(ch)) {
res->net_read_desired = 0;
res->net_write_desired = 0;
res->notify_other_threads = 0;
Expand Down
15 changes: 4 additions & 11 deletions ssl/quic/quic_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,14 +1301,7 @@ int ossl_quic_handle_events(SSL *s)
return 0;

qctx_lock(&ctx);
/*
* TODO(QUIC SERVER): We should always tick the engine, whether the current
* connection is started or not. When ticking the engine, we MUST avoid
* inadvertently starting connections that haven't started, the guards
* don't belong here.
*/
if (ctx.qc == NULL || ctx.qc->started)
ossl_quic_reactor_tick(ossl_quic_obj_get0_reactor(ctx.obj), 0);
ossl_quic_reactor_tick(ossl_quic_obj_get0_reactor(ctx.obj), 0);
qctx_unlock(&ctx);
return 1;
}
Expand Down Expand Up @@ -4782,16 +4775,16 @@ int ossl_quic_conn_poll_events(SSL *ssl, uint64_t events, int do_tick,

qctx_lock(&ctx);

if (do_tick)
ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0);

if (!ctx.qc->started) {
/* We can only try to write on non-started connection. */
if ((events & SSL_POLL_EVENT_W) != 0)
revents |= SSL_POLL_EVENT_W;
goto end;
}

if (do_tick)
ossl_quic_reactor_tick(ossl_quic_channel_get_reactor(ctx.qc->ch), 0);

if (ctx.xso != NULL) {
/* SSL object has a stream component. */

Expand Down

0 comments on commit 7701ecc

Please sign in to comment.