mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Fix up behavior of never-defered callbacks a little
This commit is contained in:
parent
5846bf6cdd
commit
390e056152
3
buffer.c
3
buffer.c
@ -333,6 +333,7 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
|
|||||||
struct evbuffer_cb_info info;
|
struct evbuffer_cb_info info;
|
||||||
size_t new_size;
|
size_t new_size;
|
||||||
uint32_t mask, masked_val;
|
uint32_t mask, masked_val;
|
||||||
|
int clear = 1;
|
||||||
|
|
||||||
if (running_deferred) {
|
if (running_deferred) {
|
||||||
mask = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
mask = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
||||||
@ -340,6 +341,8 @@ evbuffer_run_callbacks(struct evbuffer *buffer, int running_deferred)
|
|||||||
} else if (buffer->deferred_cbs) {
|
} else if (buffer->deferred_cbs) {
|
||||||
mask = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
mask = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
||||||
masked_val = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
masked_val = EVBUFFER_CB_NODEFER|EVBUFFER_CB_ENABLED;
|
||||||
|
/* Don't zero-out n_add/n_del, since */
|
||||||
|
clear = 0;
|
||||||
} else {
|
} else {
|
||||||
mask = EVBUFFER_CB_ENABLED;
|
mask = EVBUFFER_CB_ENABLED;
|
||||||
masked_val = EVBUFFER_CB_ENABLED;
|
masked_val = EVBUFFER_CB_ENABLED;
|
||||||
|
@ -36,6 +36,9 @@ extern "C" {
|
|||||||
#include "util-internal.h"
|
#include "util-internal.h"
|
||||||
#include "defer-internal.h"
|
#include "defer-internal.h"
|
||||||
|
|
||||||
|
/* Experimental cb flag: "never deferred" */
|
||||||
|
#define EVBUFFER_CB_NODEFER 2
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#endif
|
#endif
|
||||||
@ -59,11 +62,6 @@ struct evbuffer_cb_entry {
|
|||||||
void *cbarg;
|
void *cbarg;
|
||||||
/** Currently set flags on this callback. */
|
/** Currently set flags on this callback. */
|
||||||
ev_uint32_t flags;
|
ev_uint32_t flags;
|
||||||
#if 0
|
|
||||||
/** Size of the evbuffer before this callback was suspended, or 0
|
|
||||||
if this callback is not suspended. */
|
|
||||||
size_t size_before_suspend;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct bufferevent;
|
struct bufferevent;
|
||||||
|
@ -610,9 +610,6 @@ int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg
|
|||||||
* should not be invoked. */
|
* should not be invoked. */
|
||||||
#define EVBUFFER_CB_ENABLED 1
|
#define EVBUFFER_CB_ENABLED 1
|
||||||
|
|
||||||
/* Experimental cb flag: "never deferred" */
|
|
||||||
#define EVBUFFER_CB_NODEFER 2
|
|
||||||
|
|
||||||
/** Change the flags that are set for a callback on a buffer by adding more.
|
/** Change the flags that are set for a callback on a buffer by adding more.
|
||||||
|
|
||||||
@param buffer the evbuffer that the callback is watching.
|
@param buffer the evbuffer that the callback is watching.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user