From: Andre Noll <maan@tuebingen.mpg.de>
Date: Sat, 3 Jan 2015 05:46:42 +0000 (+0000)
Subject: sync_filter: Document sync_parse_config().
X-Git-Tag: v0.5.4~15
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=1bd959037dedcabf2b541f03c2bf51d179fe312f;p=paraslash.git

sync_filter: Document sync_parse_config().

This should help to understand the lifetime of the various structures
of the sync filter.
---

diff --git a/sync_filter.c b/sync_filter.c
index de30b168..82e86e90 100644
--- a/sync_filter.c
+++ b/sync_filter.c
@@ -34,7 +34,7 @@ struct sync_buddy_info {
 	bool disabled;
 };
 
-/* per open/close data */
+/* One active buddy */
 struct sync_buddy {
 	int fd;
 	struct sync_buddy_info *sbi;
@@ -42,6 +42,7 @@ struct sync_buddy {
 	struct list_head node;
 };
 
+/* Allocated in ->open() */
 struct sync_filter_context {
 	int listen_fd;
 	struct list_head buddies;
@@ -49,6 +50,7 @@ struct sync_filter_context {
 	bool ping_sent;
 };
 
+/* Allocated and freed in ->parse_config() and ->free_config(). */
 struct sync_filter_config {
 	struct sync_filter_args_info *conf;
 	struct sync_buddy_info *buddy_info;
@@ -169,6 +171,13 @@ fail:
 	}
 }
 
+/*
+ * At parse config time, we build an array of struct sync_buddy_info with one
+ * entry for each buddy given in the arguments. This array is not affected by
+ * sync_close(), so information stored there can be used for multiple instances
+ * (para_audiod). We store the resolved url and the ->disabled bit in this
+ * array.
+ */
 static int sync_parse_config(int argc, char **argv, void **result)
 {
 	int i, ret, n;