* [Patch 1/2] tabled: drop dependency on libevent from libcldc
@ 2009-11-28 3:52 Pete Zaitcev
2009-11-28 5:09 ` Jeff Garzik
2009-11-28 9:11 ` Jeff Garzik
0 siblings, 2 replies; 5+ messages in thread
From: Pete Zaitcev @ 2009-11-28 3:52 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
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 <zaitcev@redhat.com>
---
server/cldu.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff -urp -X dontdiff tabled-m/server/cldu.c tabled-tip/server/cldu.c
--- tabled-m/server/cldu.c 2009-11-26 17:49:06.127387256 -0700
+++ tabled-tip/server/cldu.c 2009-11-22 22:26:57.872388630 -0700
@@ -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, c
return 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",
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch 1/2] tabled: drop dependency on libevent from libcldc
2009-11-28 3:52 [Patch 1/2] tabled: drop dependency on libevent from libcldc Pete Zaitcev
@ 2009-11-28 5:09 ` Jeff Garzik
2009-11-28 7:07 ` Pete Zaitcev
2009-11-28 9:11 ` Jeff Garzik
1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2009-11-28 5:09 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
On 11/27/2009 10:52 PM, Pete Zaitcev wrote:
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch 1/2] tabled: drop dependency on libevent from libcldc
2009-11-28 5:09 ` Jeff Garzik
@ 2009-11-28 7:07 ` Pete Zaitcev
2009-11-28 9:08 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Pete Zaitcev @ 2009-11-28 7:07 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
On Sat, 28 Nov 2009 00:09:09 -0500
Jeff Garzik <jeff@garzik.org> wrote:
> On 11/27/2009 10:52 PM, Pete Zaitcev wrote:
> > 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.
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch 1/2] tabled: drop dependency on libevent from libcldc
2009-11-28 7:07 ` Pete Zaitcev
@ 2009-11-28 9:08 ` Jeff Garzik
0 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2009-11-28 9:08 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
On 11/28/2009 02:07 AM, Pete Zaitcev wrote:
> On Sat, 28 Nov 2009 00:09:09 -0500
> Jeff Garzik<jeff@garzik.org> wrote:
>> On 11/27/2009 10:52 PM, Pete Zaitcev wrote:
>
>>> 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.
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch 1/2] tabled: drop dependency on libevent from libcldc
2009-11-28 3:52 [Patch 1/2] tabled: drop dependency on libevent from libcldc Pete Zaitcev
2009-11-28 5:09 ` Jeff Garzik
@ 2009-11-28 9:11 ` Jeff Garzik
1 sibling, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2009-11-28 9:11 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Project Hail List
On 11/27/2009 10:52 PM, Pete Zaitcev wrote:
> 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<zaitcev@redhat.com>
>
> ---
> server/cldu.c | 24 +++++++++++++++++++++++-
> 1 file changed, 23 insertions(+), 1 deletion(-)
applied
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-28 9:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-28 3:52 [Patch 1/2] tabled: drop dependency on libevent from libcldc Pete Zaitcev
2009-11-28 5:09 ` Jeff Garzik
2009-11-28 7:07 ` Pete Zaitcev
2009-11-28 9:08 ` Jeff Garzik
2009-11-28 9:11 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.