From 1d3a008af3433485256d8386366ceaac4d48af5f Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Sat, 3 Nov 2007 22:51:26 +0000 Subject: provide hooks for outgoing pools; associate a base with a pool svn:r468 --- evrpc-internal.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'evrpc-internal.h') diff --git a/evrpc-internal.h b/evrpc-internal.h index 8b8dd691..c900f959 100644 --- a/evrpc-internal.h +++ b/evrpc-internal.h @@ -41,16 +41,30 @@ struct evrpc_hook { void *process_arg; }; +TAILQ_HEAD(evrpc_hook_list, evrpc_hook); + +/* + * this is shared between the base and the pool, so that we can reuse + * the hook adding functions; we alias both evrpc_pool and evrpc_base + * to this common structure. + */ +struct _evrpc_hooks { + /* hooks for processing outbound and inbound rpcs */ + struct evrpc_hook_list in_hooks; + struct evrpc_hook_list out_hooks; +}; + +#define input_hooks common.in_hooks +#define output_hooks common.out_hooks + struct evrpc_base { + struct _evrpc_hooks common; + /* the HTTP server under which we register our RPC calls */ struct evhttp* http_server; /* a list of all RPCs registered with us */ TAILQ_HEAD(evrpc_list, evrpc) registered_rpcs; - - /* hooks for processing outbound and inbound rpcs */ - TAILQ_HEAD(evrpc_hook_list, evrpc_hook) input_hooks; - struct evrpc_hook_list output_hooks; }; struct evrpc_req_generic; @@ -58,6 +72,10 @@ void evrpc_reqstate_free(struct evrpc_req_generic* rpc_state); /* A pool for holding evhttp_connection objects */ struct evrpc_pool { + struct _evrpc_hooks common; + + struct event_base *base; + struct evconq connections; int timeout; -- cgit v1.2.1