Merge remote-tracking branch 'origin/patches-2.0'

Conflicts:
	bufferevent_openssl.c
This commit is contained in:
Nick Mathewson 2012-10-24 22:55:17 -04:00
commit cda69d0df0
2 changed files with 12 additions and 4 deletions

View File

@ -934,11 +934,12 @@ be_openssl_readeventcb(evutil_socket_t fd, short what, void *ptr)
{ {
struct bufferevent_openssl *bev_ssl = ptr; struct bufferevent_openssl *bev_ssl = ptr;
bufferevent_incref_and_lock_(&bev_ssl->bev.bev); bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
if (what & EV_TIMEOUT) { if (what == EV_TIMEOUT) {
bufferevent_run_eventcb_(&bev_ssl->bev.bev, bufferevent_run_eventcb_(&bev_ssl->bev.bev,
BEV_EVENT_TIMEOUT|BEV_EVENT_READING); BEV_EVENT_TIMEOUT|BEV_EVENT_READING);
} else } else {
consider_reading(bev_ssl); consider_reading(bev_ssl);
}
bufferevent_decref_and_unlock_(&bev_ssl->bev.bev); bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
} }
@ -947,11 +948,12 @@ be_openssl_writeeventcb(evutil_socket_t fd, short what, void *ptr)
{ {
struct bufferevent_openssl *bev_ssl = ptr; struct bufferevent_openssl *bev_ssl = ptr;
bufferevent_incref_and_lock_(&bev_ssl->bev.bev); bufferevent_incref_and_lock_(&bev_ssl->bev.bev);
if (what & EV_TIMEOUT) { if (what == EV_TIMEOUT) {
bufferevent_run_eventcb_(&bev_ssl->bev.bev, bufferevent_run_eventcb_(&bev_ssl->bev.bev,
BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING); BEV_EVENT_TIMEOUT|BEV_EVENT_WRITING);
} } else {
consider_writing(bev_ssl); consider_writing(bev_ssl);
}
bufferevent_decref_and_unlock_(&bev_ssl->bev.bev); bufferevent_decref_and_unlock_(&bev_ssl->bev.bev);
} }

View File

@ -134,6 +134,9 @@ bufferevent_readcb(evutil_socket_t fd, short event, void *arg)
bufferevent_incref_and_lock_(bufev); bufferevent_incref_and_lock_(bufev);
if (event == EV_TIMEOUT) { 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; what |= BEV_EVENT_TIMEOUT;
goto error; goto error;
} }
@ -210,6 +213,9 @@ bufferevent_writecb(evutil_socket_t fd, short event, void *arg)
bufferevent_incref_and_lock_(bufev); bufferevent_incref_and_lock_(bufev);
if (event == EV_TIMEOUT) { 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; what |= BEV_EVENT_TIMEOUT;
goto error; goto error;
} }