aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-05 18:18:37 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-01-05 18:18:37 +0000
commitafd507caa260c3bf34046331e0971c4f4e0748d1 (patch)
tree075fc3b0f7d132e970889e05592d592c7f7334ce
parentbd126110d8a09888777fefa24382470b8b3d070e (diff)
downloadrspamd-afd507caa260c3bf34046331e0971c4f4e0748d1.tar.gz
rspamd-afd507caa260c3bf34046331e0971c4f4e0748d1.zip
Include checksum in a map struct.
-rw-r--r--src/map.c3
-rw-r--r--src/map.h23
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
@@ -17,15 +17,6 @@ enum fetch_proto {
};
/**
- * Callback data for async load
- */
-struct map_cb_data {
- gint state;
- void *prev_data;
- void *cur_data;
-};
-
-/**
* Data specific to file maps
*/
struct file_map_data {
@@ -49,6 +40,8 @@ struct http_map_data {
guint32 chunk_remain;
};
+struct map_cb_data;
+
/**
* Callback types
*/
@@ -73,11 +66,23 @@ 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
*/
gboolean check_map_proto (const gchar *map_line, gint *res, const gchar **pos);