mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 05:48:51 -04:00
support freeing of evrpc base
svn:r356
This commit is contained in:
parent
0c2808246a
commit
621a1b2947
6
evrpc.c
6
evrpc.c
@ -82,7 +82,13 @@ evrpc_init(struct evhttp *http_server)
|
|||||||
void
|
void
|
||||||
evrpc_free(struct evrpc_base *base)
|
evrpc_free(struct evrpc_base *base)
|
||||||
{
|
{
|
||||||
|
struct evrpc *rpc;
|
||||||
|
|
||||||
|
while ((rpc = TAILQ_FIRST(&base->registered_rpcs)) != NULL) {
|
||||||
|
assert(evrpc_unregister_rpc(base, rpc->uri));
|
||||||
|
}
|
||||||
|
|
||||||
|
free(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void evrpc_pool_schedule(struct evrpc_pool *pool);
|
static void evrpc_pool_schedule(struct evrpc_pool *pool);
|
||||||
|
3
evrpc.h
3
evrpc.h
@ -211,6 +211,9 @@ struct evhttp;
|
|||||||
/* functions to start up the rpc system */
|
/* functions to start up the rpc system */
|
||||||
struct evrpc_base *evrpc_init(struct evhttp *server);
|
struct evrpc_base *evrpc_init(struct evhttp *server);
|
||||||
|
|
||||||
|
/* frees the base - for now, you are responsible for making sure that no rpcs are ongoing */
|
||||||
|
void evrpc_free(struct evrpc_base *);
|
||||||
|
|
||||||
/* this macro is used to register RPCs with the HTTP Server */
|
/* this macro is used to register RPCs with the HTTP Server */
|
||||||
#define EVRPC_REGISTER(base, name, request, reply, callback, cbarg) \
|
#define EVRPC_REGISTER(base, name, request, reply, callback, cbarg) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -1079,16 +1079,16 @@ main (int argc, char **argv)
|
|||||||
|
|
||||||
test_want_only_once();
|
test_want_only_once();
|
||||||
|
|
||||||
|
evtag_test();
|
||||||
|
|
||||||
|
rpc_test();
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
test_signal_dealloc();
|
test_signal_dealloc();
|
||||||
test_signal_pipeloss();
|
test_signal_pipeloss();
|
||||||
test_signal_switchbase();
|
test_signal_switchbase();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
evtag_test();
|
|
||||||
|
|
||||||
rpc_test();
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ rpc_teardown(struct evrpc_base *base)
|
|||||||
{
|
{
|
||||||
assert(EVRPC_UNREGISTER(base, Message) == 0);
|
assert(EVRPC_UNREGISTER(base, Message) == 0);
|
||||||
assert(EVRPC_UNREGISTER(base, NeverReply) == 0);
|
assert(EVRPC_UNREGISTER(base, NeverReply) == 0);
|
||||||
|
|
||||||
|
evrpc_free(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user