tabled: drop dependency on libevent from libcldc
PATCH 1/2 tabled: drop dependency on libevent from libcldc
This patch makes it so that tabled stops relying on libcldc using libevent. Thus, libcldc would be free to drop libevent dependency.
The patched tabled can build and work with the "old" libcldc too.
--- server/cldu.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
server/cldu.c +23 -1
@@ -34,6 +34,7 @@ struct cld_session {bool forced_hosts;/* Administrator overrode default CLD */ bool sess_open;struct cldc_udp *lib;/* library state */ +struct event lib_timer;int retry_cnt;/*
@@ -216,7 +217,16 @@ static bool cldu_p_timer_ctl(void *priv, void *cb_priv, time_t secs) {struct cld_session *sp = priv; -return cldc_levent_timer (sp->lib, add, cb, cb_priv, secs); +struct cldc_udp *udp = sp->lib; +struct timeval tv = { secs,0 }; + +if (add) { + udp->cb = cb; + udp->cb_private = cb_priv; +return evtimer_add (&sp->lib_timer, &tv) ==0 ; + }else { +return evtimer_del (&sp->lib_timer) ==0 ; + } } static int cldu_p_pkt_send(void *priv, const void *addr, size_t addrlen,
@@ -226,6 +236,16 @@ static int cldu_p_pkt_send(void *priv, creturn cldc_udp_pkt_send (sp->lib, addr, addrlen, buf, buflen); } +static void cldu_udp_timer_event (int fd,short events,void *userdata) + +{ +struct cld_session *sp = userdata; +struct cldc_udp *udp = sp->lib; + +if (udp->cb) + udp->cb (udp->sess, udp->cb_private); +} +static void cldu_p_event (void *priv,struct cldc_session *csp,struct cldc_fh *fh,uint32_t what) {
@@ -287,6 +307,8 @@ static int cldu_set_cldc(struct cld_sess } hp = &sp->cldv[sp->actx].h; +evtimer_set (&sp->lib_timer, cldu_udp_timer_event, sp); + rc =cldc_udp_new (hp->host, hp->port, &sp->lib);if (rc) { applog(LOG_ERR, "cldc_udp_new(%s,%u) error: %d",
Quoted 1 line · Pete Zaitcev
The patched tabled can build and work with the "old" libcldc too.
Part of the reason for that is the continued presence of @EVENT_LIBS@ in configure.ac and select Makefile.am files.
Have you fixed that up in a follow-up patch, or is that missing?
It seems to me that your patch #2 should be patch #1, followed by patches to chunkd and tabled removing the libevent dependency.
Jeff
Quoted 8 lines · On Sat, 28 Nov 2009 00:09:09 -0500 Jeff Garzik <[email protected]> wrote:
Quoted 1 line · Pete Zaitcev
The patched tabled can build and work with the "old" libcldc too.
Part of the reason for that is the continued presence of @EVENT_LIBS@ in configure.ac and select Makefile.am files.
Have you fixed that up in a follow-up patch, or is that missing?
tabled continues to use libevent, only CLD stops it.
Quoted 2 lines
It seems to me that your patch #2 should be patch #1, followed by patches to chunkd and tabled removing the libevent dependency.
If you apply #1, nothing bad happens, tabled continues to build like before, no matter what CLD is under it. This is why it's #1. If you decided that #2 was unacceptable and tabled would not be compatible, we'd have a broken tabled, right?
-- Pete
Quoted 4 lines · Pete Zaitcev
Quoted 1 line · On Sat, 28 Nov 2009 00:09:09 -0500 Jeff Garzik<[email protected]> wrote:
On 11/27/2009 10:52 PM, Pete Zaitcev wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
The patched tabled can build and work with the "old" libcldc too.
Part of the reason for that is the continued presence of @EVENT_LIBS@ in configure.ac and select Makefile.am files.
Have you fixed that up in a follow-up patch, or is that missing?
tabled continues to use libevent, only CLD stops it.
True; only chunkd needs the modification, then.
Quoted 7 lines
Quoted 2 lines
It seems to me that your patch #2 should be patch #1, followed by patches to chunkd and tabled removing the libevent dependency.
If you apply #1, nothing bad happens, tabled continues to build like before, no matter what CLD is under it. This is why it's #1. If you decided that #2 was unacceptable and tabled would not be compatible, we'd have a broken tabled, right?
Fair enough. I will apply the tabled patch immediately, and await comments/revisions on the CLD patch (see other email).
Jeff
Jeff Garzik
AppliedQuoted 10 lines · Pete Zaitcev
This patch makes it so that tabled stops relying on libcldc using libevent. Thus, libcldc would be free to drop libevent dependency.
The patched tabled can build and work with the "old" libcldc too.
Signed-off-by Pete Zaitcev<[email protected]>--- server/cldu.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
applied