summaryrefslogtreecommitdiff
path: root/src/sync-alarm.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2011-11-16 02:10:31 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2012-01-10 01:54:45 +0100
commit75a7cd3c722e1abca14fc375bec8ab30c34ab284 (patch)
tree34b33b726bbba606ec77b98340331e026ce781a3 /src/sync-alarm.c
parent79ab299bfb20b7fc1982ca90d77d8b908b824fea (diff)
downloadconntrack-tools-75a7cd3c722e1abca14fc375bec8ab30c34ab284.tar.gz
conntrack-tools-75a7cd3c722e1abca14fc375bec8ab30c34ab284.zip
conntrackd: remove cache_data_get_object and replace by direct pointer
We now include one pointer to the object in the extra section. This is required to generalize this code for the expectation support. We consume 4-8 bytes extra, but we will not need more changes to support expectations which is a good idea.
Diffstat (limited to 'src/sync-alarm.c')
-rw-r--r--src/sync-alarm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sync-alarm.c b/src/sync-alarm.c
index 03481fd..acaf5e6 100644
--- a/src/sync-alarm.c
+++ b/src/sync-alarm.c
@@ -29,6 +29,7 @@
struct cache_alarm {
struct queue_node qnode;
+ struct cache_object *obj;
struct alarm_block alarm;
};
@@ -50,6 +51,7 @@ static void cache_alarm_add(struct cache_object *obj, void *data)
struct cache_alarm *ca = data;
queue_node_init(&ca->qnode, Q_ELEM_OBJ);
+ ca->obj = obj;
init_alarm(&ca->alarm, obj, refresher);
add_alarm(&ca->alarm,
random() % CONFIG(refresh) + 1,
@@ -131,15 +133,13 @@ static int tx_queue_xmit(struct queue_node *n, const void *data)
break;
case Q_ELEM_OBJ: {
struct cache_alarm *ca;
- struct cache_object *obj;
int type;
ca = (struct cache_alarm *)n;
- obj = cache_data_get_object(STATE(mode)->internal->ct.data, ca);
- type = object_status_to_network_type(obj);
- net = obj->cache->ops->build_msg(obj, type);
+ type = object_status_to_network_type(ca->obj);
+ net = ca->obj->cache->ops->build_msg(ca->obj, type);
multichannel_send(STATE_SYNC(channel), net);
- cache_object_put(obj);
+ cache_object_put(ca->obj);
break;
}
}