mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Forward-port: Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT, but keep the INPUT/OUTPUT aliases on non-win32 platforms to maintain backwards compatibility.
svn:r852
This commit is contained in:
parent
a6ce520cfb
commit
2baaac7fdb
@ -108,6 +108,8 @@ Changes in current version:
|
||||
o change failing behavior of event_base_new_with_config: if a config is provided and no backend is selected, return NULL instead of aborting.
|
||||
o deliver partial data to request callbacks when chunked callback is set even if there is no chunking on the http level; allows cancelation of requests from within the chunked callback; from Scott Lamb.
|
||||
o allow min_heap_erase to be called on removed members; from liusifan.
|
||||
o Rename INPUT and OUTPUT to EVRPC_INPUT and EVRPC_OUTPUT. Retain INPUT/OUTPUT aliases on on-win32 platforms for backwards compatibility.
|
||||
|
||||
|
||||
Changes in 1.4.0:
|
||||
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
|
||||
|
20
evrpc.c
20
evrpc.c
@ -97,10 +97,10 @@ evrpc_free(struct evrpc_base *base)
|
||||
assert(evrpc_unregister_rpc(base, rpc->uri));
|
||||
}
|
||||
while ((hook = TAILQ_FIRST(&base->input_hooks)) != NULL) {
|
||||
assert(evrpc_remove_hook(base, INPUT, hook));
|
||||
assert(evrpc_remove_hook(base, EVRPC_INPUT, hook));
|
||||
}
|
||||
while ((hook = TAILQ_FIRST(&base->output_hooks)) != NULL) {
|
||||
assert(evrpc_remove_hook(base, OUTPUT, hook));
|
||||
assert(evrpc_remove_hook(base, EVRPC_OUTPUT, hook));
|
||||
}
|
||||
mm_free(base);
|
||||
}
|
||||
@ -115,14 +115,14 @@ evrpc_add_hook(void *vbase,
|
||||
struct evrpc_hook_list *head = NULL;
|
||||
struct evrpc_hook *hook = NULL;
|
||||
switch (hook_type) {
|
||||
case INPUT:
|
||||
case EVRPC_INPUT:
|
||||
head = &base->in_hooks;
|
||||
break;
|
||||
case OUTPUT:
|
||||
case EVRPC_OUTPUT:
|
||||
head = &base->out_hooks;
|
||||
break;
|
||||
default:
|
||||
assert(hook_type == INPUT || hook_type == OUTPUT);
|
||||
assert(hook_type == EVRPC_INPUT || hook_type == EVRPC_OUTPUT);
|
||||
}
|
||||
|
||||
hook = mm_calloc(1, sizeof(struct evrpc_hook));
|
||||
@ -160,14 +160,14 @@ evrpc_remove_hook(void *vbase, enum EVRPC_HOOK_TYPE hook_type, void *handle)
|
||||
struct _evrpc_hooks *base = vbase;
|
||||
struct evrpc_hook_list *head = NULL;
|
||||
switch (hook_type) {
|
||||
case INPUT:
|
||||
case EVRPC_INPUT:
|
||||
head = &base->in_hooks;
|
||||
break;
|
||||
case OUTPUT:
|
||||
case EVRPC_OUTPUT:
|
||||
head = &base->out_hooks;
|
||||
break;
|
||||
default:
|
||||
assert(hook_type == INPUT || hook_type == OUTPUT);
|
||||
assert(hook_type == EVRPC_INPUT || hook_type == EVRPC_OUTPUT);
|
||||
}
|
||||
|
||||
return (evrpc_remove_hook_internal(head, handle));
|
||||
@ -525,11 +525,11 @@ evrpc_pool_free(struct evrpc_pool *pool)
|
||||
}
|
||||
|
||||
while ((hook = TAILQ_FIRST(&pool->input_hooks)) != NULL) {
|
||||
assert(evrpc_remove_hook(pool, INPUT, hook));
|
||||
assert(evrpc_remove_hook(pool, EVRPC_INPUT, hook));
|
||||
}
|
||||
|
||||
while ((hook = TAILQ_FIRST(&pool->output_hooks)) != NULL) {
|
||||
assert(evrpc_remove_hook(pool, OUTPUT, hook));
|
||||
assert(evrpc_remove_hook(pool, EVRPC_OUTPUT, hook));
|
||||
}
|
||||
|
||||
mm_free(pool);
|
||||
|
13
evrpc.h
13
evrpc.h
@ -429,10 +429,19 @@ void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
|
||||
*/
|
||||
|
||||
enum EVRPC_HOOK_TYPE {
|
||||
INPUT, /**< apply the function to an input hook */
|
||||
OUTPUT /**< apply the function to an output hook */
|
||||
EVRPC_INPUT, /**< apply the function to an input hook */
|
||||
EVRPC_OUTPUT /**< apply the function to an output hook */
|
||||
};
|
||||
|
||||
#ifndef WIN32
|
||||
/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it
|
||||
* conflicts with platform headers. */
|
||||
#define INPUT EVRPC_INPUT
|
||||
/** Deprecated alias for EVRPC_OUTPUT. Not available on windows, where it
|
||||
* conflicts with platform headers. */
|
||||
#define OUTPUT EVRPC_OUTPUT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return value from hook processing functions
|
||||
*/
|
||||
|
@ -474,15 +474,15 @@ rpc_basic_client(void)
|
||||
need_input_hook = 1;
|
||||
need_output_hook = 1;
|
||||
|
||||
assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, (void*)"input")
|
||||
assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_add_header, (void*)"input")
|
||||
!= NULL);
|
||||
assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, (void*)"output")
|
||||
assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_add_header, (void*)"output")
|
||||
!= NULL);
|
||||
|
||||
pool = rpc_pool_with_connection(port);
|
||||
|
||||
assert(evrpc_add_hook(pool, OUTPUT, rpc_hook_add_meta, NULL));
|
||||
assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, (void*)"output"));
|
||||
assert(evrpc_add_hook(pool, EVRPC_OUTPUT, rpc_hook_add_meta, NULL));
|
||||
assert(evrpc_add_hook(pool, EVRPC_INPUT, rpc_hook_remove_header, (void*)"output"));
|
||||
|
||||
/* set up the basic message */
|
||||
msg = msg_new();
|
||||
@ -662,13 +662,13 @@ rpc_basic_client_with_pause(void)
|
||||
|
||||
rpc_setup(&http, &port, &base);
|
||||
|
||||
assert(evrpc_add_hook(base, INPUT, rpc_hook_pause, base));
|
||||
assert(evrpc_add_hook(base, OUTPUT, rpc_hook_pause, base));
|
||||
assert(evrpc_add_hook(base, EVRPC_INPUT, rpc_hook_pause, base));
|
||||
assert(evrpc_add_hook(base, EVRPC_OUTPUT, rpc_hook_pause, base));
|
||||
|
||||
pool = rpc_pool_with_connection(port);
|
||||
|
||||
assert(evrpc_add_hook(pool, INPUT, rpc_hook_pause, pool));
|
||||
assert(evrpc_add_hook(pool, OUTPUT, rpc_hook_pause, pool));
|
||||
assert(evrpc_add_hook(pool, EVRPC_INPUT, rpc_hook_pause, pool));
|
||||
assert(evrpc_add_hook(pool, EVRPC_OUTPUT, rpc_hook_pause, pool));
|
||||
|
||||
/* set up the basic message */
|
||||
msg = msg_new();
|
||||
|
Loading…
x
Reference in New Issue
Block a user