"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/liblsquic/lsquic_stream.c" between
lsquic-2.22.1.tar.gz and lsquic-2.23.1.tar.gz

About: LSQUIC is LiteSpeed’s QUIC and HTTP/3 Library. A hint: HTTP/3 uses QUIC as the underlying transport protocol instead of TCP.

lsquic_stream.c  (lsquic-2.22.1):lsquic_stream.c  (lsquic-2.23.1)
skipping to change at line 363 skipping to change at line 363
/* GQUIC-only function */ /* GQUIC-only function */
static int static int
stream_is_hsk (const struct lsquic_stream *stream) stream_is_hsk (const struct lsquic_stream *stream)
{ {
if (stream->sm_bflags & SMBF_IETF) if (stream->sm_bflags & SMBF_IETF)
return 0; return 0;
else else
return lsquic_stream_is_crypto(stream); return lsquic_stream_is_crypto(stream);
} }
/* This function's only job is to change the allocated packet's header
* type to HETY_0RTT when stream frames are written before handshake
* is complete.
*/
static struct lsquic_packet_out *
stream_get_packet_for_stream_0rtt (struct lsquic_send_ctl *ctl,
unsigned need_at_least, const struct network_path *path,
const struct lsquic_stream *stream)
{
struct lsquic_packet_out *packet_out;
if (stream->conn_pub->lconn->cn_flags & LSCONN_HANDSHAKE_DONE)
{
LSQ_DEBUG("switch to regular \"get packet for stream\" function");
/* Here we drop the "const" because this is a static function.
* Otherwise, we would not condone such sorcery.
*/
((struct lsquic_stream *) stream)->sm_get_packet_for_stream
= lsquic_send_ctl_get_packet_for_stream;
return lsquic_send_ctl_get_packet_for_stream(ctl, need_at_least,
path, stream);
}
else
{
packet_out = lsquic_send_ctl_get_packet_for_stream(ctl, need_at_least,
path, stream);
if (packet_out)
packet_out->po_header_type = HETY_0RTT;
return packet_out;
}
}
static struct lsquic_stream * static struct lsquic_stream *
stream_new_common (lsquic_stream_id_t id, struct lsquic_conn_public *conn_pub, stream_new_common (lsquic_stream_id_t id, struct lsquic_conn_public *conn_pub,
const struct lsquic_stream_if *stream_if, void *stream_if_ctx, const struct lsquic_stream_if *stream_if, void *stream_if_ctx,
enum stream_ctor_flags ctor_flags) enum stream_ctor_flags ctor_flags)
{ {
struct lsquic_stream *stream; struct lsquic_stream *stream;
stream = calloc(1, sizeof(*stream)); stream = calloc(1, sizeof(*stream));
if (!stream) if (!stream)
return NULL; return NULL;
skipping to change at line 395 skipping to change at line 427
stream->stream_if = stream_if; stream->stream_if = stream_if;
stream->conn_pub = conn_pub; stream->conn_pub = conn_pub;
stream->sm_onnew_arg = stream_if_ctx; stream->sm_onnew_arg = stream_if_ctx;
stream->sm_write_avail = stream_write_avail_no_frames; stream->sm_write_avail = stream_write_avail_no_frames;
STAILQ_INIT(&stream->sm_hq_frames); STAILQ_INIT(&stream->sm_hq_frames);
stream->sm_bflags |= ctor_flags & ((1 << N_SMBF_FLAGS) - 1); stream->sm_bflags |= ctor_flags & ((1 << N_SMBF_FLAGS) - 1);
if (conn_pub->lconn->cn_flags & LSCONN_SERVER) if (conn_pub->lconn->cn_flags & LSCONN_SERVER)
stream->sm_bflags |= SMBF_SERVER; stream->sm_bflags |= SMBF_SERVER;
stream->sm_get_packet_for_stream = lsquic_send_ctl_get_packet_for_stream;
return stream; return stream;
} }
lsquic_stream_t * lsquic_stream_t *
lsquic_stream_new (lsquic_stream_id_t id, lsquic_stream_new (lsquic_stream_id_t id,
struct lsquic_conn_public *conn_pub, struct lsquic_conn_public *conn_pub,
const struct lsquic_stream_if *stream_if, void *stream_if_ctx, const struct lsquic_stream_if *stream_if, void *stream_if_ctx,
unsigned initial_window, uint64_t initial_send_off, unsigned initial_window, uint64_t initial_send_off,
enum stream_ctor_flags ctor_flags) enum stream_ctor_flags ctor_flags)
skipping to change at line 468 skipping to change at line 501
else else
{ {
if (stream_is_hsk(stream)) if (stream_is_hsk(stream))
stream->sm_write_to_packet = stream_write_to_packet_hsk; stream->sm_write_to_packet = stream_write_to_packet_hsk;
else else
stream->sm_write_to_packet = stream_write_to_packet_std; stream->sm_write_to_packet = stream_write_to_packet_std;
stream->sm_frame_header_sz = stream_stream_frame_header_sz; stream->sm_frame_header_sz = stream_stream_frame_header_sz;
} }
} }
if ((stream->sm_bflags & (SMBF_SERVER|SMBF_IETF)) == SMBF_IETF
&& !(conn_pub->lconn->cn_flags & LSCONN_HANDSHAKE_DONE))
{
LSQ_DEBUG("use wrapper \"get packet for stream\" function");
stream->sm_get_packet_for_stream = stream_get_packet_for_stream_0rtt;
}
lsquic_sfcw_init(&stream->fc, initial_window, cfcw, conn_pub, id); lsquic_sfcw_init(&stream->fc, initial_window, cfcw, conn_pub, id);
stream->max_send_off = initial_send_off; stream->max_send_off = initial_send_off;
LSQ_DEBUG("created stream"); LSQ_DEBUG("created stream");
SM_HISTORY_APPEND(stream, SHE_CREATED); SM_HISTORY_APPEND(stream, SHE_CREATED);
if (ctor_flags & SCF_CALL_ON_NEW) if (ctor_flags & SCF_CALL_ON_NEW)
lsquic_stream_call_on_new(stream); lsquic_stream_call_on_new(stream);
return stream; return stream;
} }
struct lsquic_stream * struct lsquic_stream *
skipping to change at line 567 skipping to change at line 607
static void static void
drop_buffered_data (struct lsquic_stream *stream) drop_buffered_data (struct lsquic_stream *stream)
{ {
decr_conn_cap(stream, stream->sm_n_buffered); decr_conn_cap(stream, stream->sm_n_buffered);
stream->sm_n_buffered = 0; stream->sm_n_buffered = 0;
maybe_resize_stream_buffer(stream); maybe_resize_stream_buffer(stream);
if (stream->sm_qflags & SMQF_WRITE_Q_FLAGS) if (stream->sm_qflags & SMQF_WRITE_Q_FLAGS)
maybe_remove_from_write_q(stream, SMQF_WRITE_Q_FLAGS); maybe_remove_from_write_q(stream, SMQF_WRITE_Q_FLAGS);
} }
void
lsquic_stream_drop_hset_ref (struct lsquic_stream *stream)
{
if (stream->uh)
stream->uh->uh_hset = NULL;
}
static void static void
destroy_uh (struct lsquic_stream *stream) destroy_uh (struct lsquic_stream *stream)
{ {
if (stream->uh) if (stream->uh)
{ {
if (stream->uh->uh_hset) if (stream->uh->uh_hset)
stream->conn_pub->enpub->enp_hsi_if stream->conn_pub->enpub->enp_hsi_if
->hsi_discard_header_set(stream->uh->uh_hset); ->hsi_discard_header_set(stream->uh->uh_hset);
free(stream->uh); free(stream->uh);
stream->uh = NULL; stream->uh = NULL;
skipping to change at line 2962 skipping to change at line 3009
need_at_least = stream_header_sz; need_at_least = stream_header_sz;
if ((stream->sm_bflags & (SMBF_IETF|SMBF_USE_HEADERS)) if ((stream->sm_bflags & (SMBF_IETF|SMBF_USE_HEADERS))
== (SMBF_IETF|SMBF_USE_HEADERS)) == (SMBF_IETF|SMBF_USE_HEADERS))
{ {
if (size > 0) if (size > 0)
need_at_least += 3; /* Enough room for HTTP/3 frame */ need_at_least += 3; /* Enough room for HTTP/3 frame */
} }
else else
need_at_least += size > 0; need_at_least += size > 0;
get_packet: get_packet:
packet_out = lsquic_send_ctl_get_packet_for_stream(send_ctl, packet_out = stream->sm_get_packet_for_stream(send_ctl,
need_at_least, stream->conn_pub->path, stream); need_at_least, stream->conn_pub->path, stream);
if (packet_out) if (packet_out)
{ {
len = write_stream_frame(fg_ctx, size, packet_out); len = write_stream_frame(fg_ctx, size, packet_out);
if (len > 0) if (len > 0)
return SWTP_OK; return SWTP_OK;
assert(len < 0); assert(len < 0);
if (-len > (int) need_at_least) if (-len > (int) need_at_least)
{ {
LSQ_DEBUG("need more room (%d bytes) than initially calculated " LSQ_DEBUG("need more room (%d bytes) than initially calculated "
 End of changes. 5 change blocks. 
1 lines changed or deleted 48 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)