mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Merge remote-tracking branch 'origin/patches-2.0'
This commit is contained in:
commit
0d10804465
2
buffer.c
2
buffer.c
@ -432,7 +432,7 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
void
|
||||
evbuffer_invoke_callbacks(struct evbuffer *buffer)
|
||||
{
|
||||
if (TAILQ_EMPTY(&buffer->callbacks)) {
|
||||
|
@ -127,6 +127,9 @@ evbuffer_commit_read(struct evbuffer *evbuf, ev_ssize_t nBytes)
|
||||
buf->read_in_progress = 0;
|
||||
|
||||
evbuf->total_len += nBytes;
|
||||
evbuf->n_add_for_cb += nBytes;
|
||||
|
||||
evbuffer_invoke_callbacks(evbuf);
|
||||
|
||||
_evbuffer_decref_and_unlock(evbuf);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ bev_async_consider_writing(struct bufferevent_async *beva)
|
||||
|
||||
/* Don't write if there's a write in progress, or we do not
|
||||
* want to write, or when there's nothing left to write. */
|
||||
if (beva->write_in_progress)
|
||||
if (beva->write_in_progress || beva->bev.connecting)
|
||||
return;
|
||||
if (!beva->ok || !(bev->enabled&EV_WRITE) ||
|
||||
!evbuffer_get_length(bev->output)) {
|
||||
@ -235,7 +235,7 @@ bev_async_consider_reading(struct bufferevent_async *beva)
|
||||
|
||||
/* Don't read if there is a read in progress, or we do not
|
||||
* want to read. */
|
||||
if (beva->read_in_progress)
|
||||
if (beva->read_in_progress || beva->bev.connecting)
|
||||
return;
|
||||
if (!beva->ok || !(bev->enabled&EV_READ)) {
|
||||
bev_async_del_read(beva);
|
||||
@ -325,7 +325,11 @@ be_async_enable(struct bufferevent *buf, short what)
|
||||
if (!bev_async->ok)
|
||||
return -1;
|
||||
|
||||
/* NOTE: This interferes with non-blocking connect */
|
||||
if (bev_async->bev.connecting) {
|
||||
/* Don't launch anything during connection attempts. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (what & EV_READ)
|
||||
BEV_RESET_GENERIC_READ_TIMEOUT(buf);
|
||||
if (what & EV_WRITE)
|
||||
|
@ -303,6 +303,8 @@ int _evbuffer_read_setup_vecs(struct evbuffer *buf, ev_ssize_t howmuch,
|
||||
/** Set the parent bufferevent object for buf to bev */
|
||||
void evbuffer_set_parent(struct evbuffer *buf, struct bufferevent *bev);
|
||||
|
||||
void evbuffer_invoke_callbacks(struct evbuffer *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user