Skip to content

Commit

Permalink
Release 1.16.0
Browse files Browse the repository at this point in the history
- [API Change] Add lsquic_conn_n_avail_streams()
- [BUGFIX] only dispatch crypto stream read events if WANT_READ is on
  • Loading branch information
Dmitri Tikhonov committed Oct 3, 2018
1 parent 0a19f39 commit 66f9afc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-10-03
- 1.16.0
- [API Change] Add lsquic_conn_n_avail_streams()
- [BUGFIX] only dispatch crypto stream read events if WANT_READ is on

2018-09-27
- 1.15.0
- [API Change] Add LSCONN_ST_PEER_GOING_AWAY to the list of conn statuses
Expand Down
6 changes: 5 additions & 1 deletion include/lsquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ extern "C" {
#endif

#define LSQUIC_MAJOR_VERSION 1
#define LSQUIC_MINOR_VERSION 15
#define LSQUIC_MINOR_VERSION 16
#define LSQUIC_PATCH_VERSION 0

/**
Expand Down Expand Up @@ -668,6 +668,10 @@ lsquic_engine_send_unsent_packets (lsquic_engine_t *engine);
void
lsquic_engine_destroy (lsquic_engine_t *);

/** Return max allowed outbound streams less current outbound streams. */
unsigned
lsquic_conn_n_avail_streams (const lsquic_conn_t *);

void lsquic_conn_make_stream(lsquic_conn_t *);

/** Return number of delayed streams currently pending */
Expand Down
15 changes: 13 additions & 2 deletions src/liblsquic/lsquic_full_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,12 +989,22 @@ either_side_going_away (const struct full_conn *conn)
}


unsigned
lsquic_conn_n_avail_streams (const lsquic_conn_t *lconn)
{
struct full_conn *conn = (struct full_conn *) lconn;
unsigned stream_count = count_streams(conn, 0);
if (conn->fc_cfg.max_streams_out < stream_count)
return 0;
return conn->fc_cfg.max_streams_out - stream_count;
}


void
lsquic_conn_make_stream (lsquic_conn_t *lconn)
{
struct full_conn *conn = (struct full_conn *) lconn;
unsigned stream_count = count_streams(conn, 0);
if (stream_count < conn->fc_cfg.max_streams_out)
if (lsquic_conn_n_avail_streams(lconn) > 0)
{
if (!new_stream(conn, generate_stream_id(conn), SCF_CALL_ON_NEW))
ABORT_ERROR("could not create new stream: %s", strerror(errno));
Expand Down Expand Up @@ -1220,6 +1230,7 @@ process_stream_frame (struct full_conn *conn, lsquic_packet_in_t *packet_in,
}

if (stream->id == LSQUIC_STREAM_HANDSHAKE
&& (stream->stream_flags & STREAM_WANT_READ)
&& !(conn->fc_flags & FC_SERVER)
&& !(conn->fc_conn.cn_flags & LSCONN_HANDSHAKE_DONE))
{ /* To enable decryption, process handshake stream as soon as its
Expand Down

0 comments on commit 66f9afc

Please sign in to comment.