From 03084f7517ee7b6cbfed2fac6cb5bcb4a4d64612 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 29 Oct 2017 23:09:23 +0900 Subject: [PATCH] examples: Make client and server work with libevent-2.1.8 --- doc/sources/tutorial-client.rst | 1 + examples/libevent-client.c | 1 + examples/libevent-server.c | 1 + 3 files changed, 3 insertions(+) diff --git a/doc/sources/tutorial-client.rst b/doc/sources/tutorial-client.rst index 2262f675..46fc34b6 100644 --- a/doc/sources/tutorial-client.rst +++ b/doc/sources/tutorial-client.rst @@ -124,6 +124,7 @@ remote server. It's defined as:: bev = bufferevent_openssl_socket_new( evbase, -1, ssl, BUFFEREVENT_SSL_CONNECTING, BEV_OPT_DEFER_CALLBACKS | BEV_OPT_CLOSE_ON_FREE); + bufferevent_enable(bev, EV_READ | EV_WRITE); bufferevent_setcb(bev, readcb, writecb, eventcb, session_data); rv = bufferevent_socket_connect_hostname(bev, session_data->dnsbase, AF_UNSPEC, host, port); diff --git a/examples/libevent-client.c b/examples/libevent-client.c index 862f54c4..bfee21ea 100644 --- a/examples/libevent-client.c +++ b/examples/libevent-client.c @@ -548,6 +548,7 @@ static void initiate_connection(struct event_base *evbase, SSL_CTX *ssl_ctx, bev = bufferevent_openssl_socket_new( evbase, -1, ssl, BUFFEREVENT_SSL_CONNECTING, BEV_OPT_DEFER_CALLBACKS | BEV_OPT_CLOSE_ON_FREE); + bufferevent_enable(bev, EV_READ | EV_WRITE); bufferevent_setcb(bev, readcb, writecb, eventcb, session_data); rv = bufferevent_socket_connect_hostname(bev, session_data->dnsbase, AF_UNSPEC, host, port); diff --git a/examples/libevent-server.c b/examples/libevent-server.c index b7945a0f..403d2dd4 100644 --- a/examples/libevent-server.c +++ b/examples/libevent-server.c @@ -250,6 +250,7 @@ static http2_session_data *create_http2_session_data(app_context *app_ctx, session_data->bev = bufferevent_openssl_socket_new( app_ctx->evbase, fd, ssl, BUFFEREVENT_SSL_ACCEPTING, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_DEFER_CALLBACKS); + bufferevent_enable(session_data->bev, EV_READ | EV_WRITE); rv = getnameinfo(addr, (socklen_t)addrlen, host, sizeof(host), NULL, 0, NI_NUMERICHOST); if (rv != 0) {