Skip to content

Commit

Permalink
Release 1.17.10
Browse files Browse the repository at this point in the history
Fix the example program to be able to use parallel connections
again.  (See the -n argument.)
  • Loading branch information
Dmitri Tikhonov committed Dec 27, 2018
1 parent 6b58dff commit f2450c4
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/lsquic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
53 changes: 49 additions & 4 deletions test/http_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <event2/event.h>


#ifndef WIN32
Expand Down Expand Up @@ -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));
Expand All @@ -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);
}

Expand Down

0 comments on commit f2450c4

Please sign in to comment.