From afd507caa260c3bf34046331e0971c4f4e0748d1 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 5 Jan 2014 18:18:37 +0000 Subject: [PATCH] Include checksum in a map struct. --- src/map.c | 3 +++ src/map.h | 23 ++++++++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/map.c b/src/map.c index 2af883a7a..ea5b1a35a 100644 --- a/src/map.c +++ b/src/map.c @@ -396,6 +396,7 @@ read_http_sync (struct rspamd_map *map, struct http_map_data *data) write_http_request (map, data, fd); cbdata.state = 0; + cbdata.map = map; cbdata.prev_data = *map->user_data; cbdata.cur_data = NULL; @@ -442,6 +443,7 @@ read_map_file (struct rspamd_map *map, struct file_map_data *data) cbdata.state = 0; cbdata.prev_data = *map->user_data; cbdata.cur_data = NULL; + cbdata.map = map; rlen = 0; while ((r = read (fd, buf + rlen, sizeof (buf) - rlen - 1)) > 0) { @@ -836,6 +838,7 @@ http_async_callback (gint fd, short what, void *ud) cbd->cbdata.state = 0; cbd->cbdata.prev_data = *cbd->map->user_data; cbd->cbdata.cur_data = NULL; + cbd->cbdata.map = cbd->map; cbd->data->rlen = 0; cbd->data->chunk = 0; cbd->data->chunk_remain = 0; diff --git a/src/map.h b/src/map.h index ec35f8486..ac7338247 100644 --- a/src/map.h +++ b/src/map.h @@ -16,15 +16,6 @@ enum fetch_proto { MAP_PROTO_HTTP, }; -/** - * Callback data for async load - */ -struct map_cb_data { - gint state; - void *prev_data; - void *cur_data; -}; - /** * Data specific to file maps */ @@ -49,6 +40,8 @@ struct http_map_data { guint32 chunk_remain; }; +struct map_cb_data; + /** * Callback types */ @@ -73,10 +66,22 @@ struct rspamd_map { gchar *uri; gchar *description; guint32 id; + guint32 checksum; /* Shared lock for temporary disabling of map reading (e.g. when this map is written by UI) */ gint *locked; }; +/** + * Callback data for async load + */ +struct map_cb_data { + struct rspamd_map *map; + gint state; + void *prev_data; + void *cur_data; +}; + + /** * Check map protocol */ -- 2.39.5