Release 1.17.10

Fix the example program to be able to use parallel connections
again.  (See the -n argument.)
This commit is contained in:
Dmitri Tikhonov 2018-12-27 14:01:17 -05:00
parent 6b58dff0c3
commit f2450c4325
3 changed files with 56 additions and 6 deletions

View File

@ -1,6 +1,11 @@
2018-12-27
- 1.17.10
- Fix the example program to be able to use parallel connections
again. (See the -n argument.)
2018-12-18
- 1.17.9
- [BUGFIX] Engine: reduce minumum batch size from 256 to 4
- [BUGFIX] Engine: reduce minimum batch size from 256 to 4
2018-12-10
- 1.17.8

View File

@ -25,7 +25,7 @@ extern "C" {
#define LSQUIC_MAJOR_VERSION 1
#define LSQUIC_MINOR_VERSION 17
#define LSQUIC_PATCH_VERSION 9
#define LSQUIC_PATCH_VERSION 10
/**
* Engine flags:

View File

@ -30,6 +30,7 @@
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <event2/event.h>
#ifndef WIN32
@ -153,11 +154,39 @@ http_client_on_new_conn (void *stream_if_ctx, lsquic_conn_t *conn)
}
struct create_another_conn_or_stop_ctx
{
struct event *event;
struct http_client_ctx *client_ctx;
};
static void
create_another_conn_or_stop (evutil_socket_t sock, short events, void *ctx)
{
struct create_another_conn_or_stop_ctx *const cacos = ctx;
struct http_client_ctx *const client_ctx = cacos->client_ctx;
event_del(cacos->event);
event_free(cacos->event);
free(cacos);
create_connections(client_ctx);
if (0 == client_ctx->hcc_n_open_conns)
{
LSQ_INFO("All connections are closed: stop engine");
prog_stop(client_ctx->prog);
}
}
static void
http_client_on_conn_closed (lsquic_conn_t *conn)
{
lsquic_conn_ctx_t *conn_h = lsquic_conn_get_ctx(conn);
struct create_another_conn_or_stop_ctx *cacos;
enum LSQUIC_CONN_STATUS status;
struct event_base *eb;
char errmsg[80];
status = lsquic_conn_status(conn, errmsg, sizeof(errmsg));
@ -170,12 +199,28 @@ http_client_on_conn_closed (lsquic_conn_t *conn)
}
TAILQ_REMOVE(&conn_h->client_ctx->conn_ctxs, conn_h, next_ch);
--conn_h->client_ctx->hcc_n_open_conns;
create_connections(conn_h->client_ctx);
if (0 == conn_h->client_ctx->hcc_n_open_conns)
cacos = calloc(1, sizeof(*cacos));
if (!cacos)
{
LSQ_INFO("All connections are closed: stop engine");
prog_stop(conn_h->client_ctx->prog);
LSQ_ERROR("cannot allocate cacos");
exit(1);
}
eb = prog_eb(conn_h->client_ctx->prog);
cacos->client_ctx = conn_h->client_ctx;
cacos->event = event_new(eb, -1, 0, create_another_conn_or_stop, cacos);
if (!cacos->event)
{
LSQ_ERROR("cannot allocate event");
exit(1);
}
if (0 != event_add(cacos->event, NULL))
{
LSQ_ERROR("cannot add cacos event");
exit(1);
}
event_active(cacos->event, 0, 0);
free(conn_h);
}