From: Andrew Tridgell Date: Tue, 8 May 2007 11:16:29 +0000 (+1000) Subject: fixed a problem with the number of timed events growing without bound with the new... X-Git-Tag: tevent-0.9.20~348^2~2767 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fdb8144e622a3cdeb1e74187789a1a0d0f23e0db;p=thirdparty%2Fsamba.git fixed a problem with the number of timed events growing without bound with the new seqnum code (This used to be ctdb commit 6109ae3dae8d93c93a2dc76cc561ea6e21458aa6) --- diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 9b19dd45e4f..876522f86f0 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -440,8 +440,9 @@ static void ctdb_ltdb_seqnum_check(struct event_context *ev, struct timed_event ctdb_db->seqnum = new_seqnum; /* setup a new timer */ - event_add_timed(ctdb->ev, ctdb_db, timeval_current_ofs(ctdb->seqnum_frequency, 0), - ctdb_ltdb_seqnum_check, ctdb_db); + ctdb_db->te = event_add_timed(ctdb->ev, ctdb_db, + timeval_current_ofs(ctdb->seqnum_frequency, 0), + ctdb_ltdb_seqnum_check, ctdb_db); } /* @@ -456,8 +457,11 @@ int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, uint32_t db_id) return -1; } - event_add_timed(ctdb->ev, ctdb_db, timeval_current_ofs(ctdb->seqnum_frequency, 0), - ctdb_ltdb_seqnum_check, ctdb_db); + if (ctdb_db->te == NULL) { + ctdb_db->te = event_add_timed(ctdb->ev, ctdb_db, + timeval_current_ofs(ctdb->seqnum_frequency, 0), + ctdb_ltdb_seqnum_check, ctdb_db); + } tdb_enable_seqnum(ctdb_db->ltdb->tdb); ctdb_db->seqnum = tdb_get_seqnum(ctdb_db->ltdb->tdb); diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 208b896211d..3ade8e714b2 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -246,6 +246,7 @@ struct ctdb_db_context { struct tdb_wrap *ltdb; struct ctdb_registered_call *calls; /* list of registered calls */ uint32_t seqnum; + struct timed_event *te; };