Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'public/20_bev_timeout_semantics' into p…

…atches-2.0
  • Loading branch information...
commit 1ff2c249bd834a0b2f7de69ed88b61b036bbbf7e 2 parents 1acf2eb + 576b29f
Nick Mathewson authored
Showing with 12 additions and 4 deletions.
  1. +6 −4 bufferevent_openssl.c
  2. +6 −0 bufferevent_sock.c
View
10 bufferevent_openssl.c
@@ -931,11 +931,12 @@ be_openssl_readeventcb(evutil_socket_t fd, short what, void *ptr)
{
struct bufferevent_openssl *bev_ssl = ptr;
_bufferevent_incref_and_lock(&bev_ssl->bev.bev);
- if (what & EV_TIMEOUT) {
+ if (what == EV_TIMEOUT) {
_bufferevent_run_eventcb(&bev_ssl->bev.bev,
BEV_EVENT_TIMEOUT|BEV_EVENT_READING);
- } else
+ } else {
consider_reading(bev_ssl);
+ }
_bufferevent_decref_and_unlock(&bev_ssl->bev.bev);
}
@@ -944,11 +945,12 @@ be_openssl_writeeventcb(evutil_socket_t fd, short what, void *ptr)
{
struct bufferevent_openssl *bev_ssl = ptr;
_bufferevent_incref_and_lock(&bev_ssl->bev.bev);
- if (what & EV_TIMEOUT) {
+ if (what == EV_TIMEOUT) {
_bufferevent_run_eventcb(&bev_ssl->bev.bev,
BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING);
+ } else {
+ consider_writing(bev_ssl);
}
- consider_writing(bev_ssl);
_bufferevent_decref_and_unlock(&bev_ssl->bev.bev);
}
View
6 bufferevent_sock.c
@@ -133,6 +133,9 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
_bufferevent_incref_and_lock(bufev);
if (event == EV_TIMEOUT) {
+ /* Note that we only check for event==EV_TIMEOUT. If
+ * event==EV_TIMEOUT|EV_READ, we can safely ignore the
+ * timeout, since a read has occurred */
what |= BEV_EVENT_TIMEOUT;
goto error;
}
@@ -209,6 +212,9 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
_bufferevent_incref_and_lock(bufev);
if (event == EV_TIMEOUT) {
+ /* Note that we only check for event==EV_TIMEOUT. If
+ * event==EV_TIMEOUT|EV_WRITE, we can safely ignore the
+ * timeout, since a read has occurred */
what |= BEV_EVENT_TIMEOUT;
goto error;
}
Please sign in to comment.
Something went wrong with that request. Please try again.