mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Latest changes
- [API Change] Add optional callback to call when handshake is done - [API Change, BUGFIX] After send failure, wait until transport available
This commit is contained in:
parent
04468d215d
commit
c44946ecd7
10 changed files with 107 additions and 3 deletions
|
@ -302,6 +302,7 @@ lsquic_engine_new (unsigned flags,
|
|||
return NULL;
|
||||
}
|
||||
engine->pub.enp_ver_tags_len = tag_buf_len;
|
||||
engine->pub.enp_flags = ENPUB_CAN_SEND;
|
||||
|
||||
engine->flags = flags;
|
||||
engine->stream_if = api->ea_stream_if;
|
||||
|
@ -951,7 +952,9 @@ send_batch (lsquic_engine_t *engine, struct conns_out_iter *conns_iter,
|
|||
LSQ_DEBUG("packets out returned %d (out of %u)", n_sent, n_to_send);
|
||||
else
|
||||
{
|
||||
engine->pub.enp_flags &= ~ENPUB_CAN_SEND;
|
||||
LSQ_DEBUG("packets out returned an error: %s", strerror(errno));
|
||||
EV_LOG_GENERIC_EVENT("cannot send packets");
|
||||
n_sent = 0;
|
||||
}
|
||||
if (n_sent > 0)
|
||||
|
@ -1147,6 +1150,12 @@ lsquic_engine_send_unsent_packets (lsquic_engine_t *engine)
|
|||
|
||||
STAILQ_INIT(&closed_conns);
|
||||
reset_deadline(engine, lsquic_time_now());
|
||||
if (!(engine->pub.enp_flags & ENPUB_CAN_SEND))
|
||||
{
|
||||
LSQ_DEBUG("can send again");
|
||||
EV_LOG_GENERIC_EVENT("can send again");
|
||||
engine->pub.enp_flags |= ENPUB_CAN_SEND;
|
||||
}
|
||||
|
||||
send_packets_out(engine, &closed_conns);
|
||||
|
||||
|
@ -1199,7 +1208,8 @@ process_connections (lsquic_engine_t *engine, conn_iter_f next_conn,
|
|||
STAILQ_INSERT_TAIL(&ticked_conns, conn, cn_next_ticked);
|
||||
}
|
||||
|
||||
if (lsquic_engine_has_unsent_packets(engine))
|
||||
if ((engine->pub.enp_flags & ENPUB_CAN_SEND)
|
||||
&& lsquic_engine_has_unsent_packets(engine))
|
||||
send_packets_out(engine, &closed_conns);
|
||||
|
||||
while ((conn = STAILQ_FIRST(&closed_conns))) {
|
||||
|
|
|
@ -21,6 +21,7 @@ struct lsquic_engine_public {
|
|||
ENPUB_PROC = (1 << 0), /* Being processed by one of the user-facing
|
||||
* functions.
|
||||
*/
|
||||
ENPUB_CAN_SEND = (1 << 1),
|
||||
} enp_flags;
|
||||
unsigned char enp_ver_tags_buf[ sizeof(lsquic_ver_tag_t) * N_LSQVER ];
|
||||
unsigned enp_ver_tags_len;
|
||||
|
|
|
@ -3033,6 +3033,8 @@ full_conn_ci_handshake_ok (lsquic_conn_t *lconn)
|
|||
lconn->cn_flags |= LSCONN_HANDSHAKE_DONE;
|
||||
else
|
||||
conn->fc_flags |= FC_ERROR;
|
||||
if (conn->fc_stream_ifs[STREAM_IF_STD].stream_if->on_hsk_done)
|
||||
conn->fc_stream_ifs[STREAM_IF_STD].stream_if->on_hsk_done(lconn, 1);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3043,6 +3045,8 @@ full_conn_ci_handshake_failed (lsquic_conn_t *lconn)
|
|||
LSQ_DEBUG("handshake failed");
|
||||
lsquic_alarmset_unset(&conn->fc_alset, AL_HANDSHAKE);
|
||||
conn->fc_flags |= FC_HSK_FAILED;
|
||||
if (conn->fc_stream_ifs[STREAM_IF_STD].stream_if->on_hsk_done)
|
||||
conn->fc_stream_ifs[STREAM_IF_STD].stream_if->on_hsk_done(lconn, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3389,7 +3393,8 @@ full_conn_ci_is_tickable (lsquic_conn_t *lconn)
|
|||
if (!TAILQ_EMPTY(&conn->fc_pub.service_streams))
|
||||
return 1;
|
||||
|
||||
if (lsquic_send_ctl_can_send(&conn->fc_send_ctl)
|
||||
if ((conn->fc_enpub->enp_flags & ENPUB_CAN_SEND)
|
||||
&& lsquic_send_ctl_can_send(&conn->fc_send_ctl)
|
||||
&& (should_generate_ack(conn) ||
|
||||
!lsquic_send_ctl_sched_is_blocked(&conn->fc_send_ctl)))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue