aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_sampler_elem.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2016-09-06 14:05:44 +0000
committerJulius Bünger <buenger@mytum.de>2016-09-06 14:05:44 +0000
commit95cac55800e8f7b4e59a03d5acefb200b20ab3c1 (patch)
tree7fef7ad0c82e03b7596c0c28cf0944d16ebc8e48 /src/rps/gnunet-service-rps_sampler_elem.c
parentd6d12f337d2ff7184415ebbbbe1e0d58cdda1867 (diff)
downloadgnunet-95cac55800e8f7b4e59a03d5acefb200b20ab3c1.tar.gz
gnunet-95cac55800e8f7b4e59a03d5acefb200b20ab3c1.zip
-rps: proper destruction of sampler elements
Diffstat (limited to 'src/rps/gnunet-service-rps_sampler_elem.c')
-rw-r--r--src/rps/gnunet-service-rps_sampler_elem.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rps/gnunet-service-rps_sampler_elem.c b/src/rps/gnunet-service-rps_sampler_elem.c
index c22ed564b..007f818e2 100644
--- a/src/rps/gnunet-service-rps_sampler_elem.c
+++ b/src/rps/gnunet-service-rps_sampler_elem.c
@@ -99,6 +99,24 @@ RPS_sampler_elem_create (void)
99 99
100 100
101/** 101/**
102 * Destroy a sampler element.
103 *
104 * @param sampler_elem the element to destroy
105 */
106void
107RPS_sampler_elem_destroy (struct RPS_SamplerElement *sampler_elem)
108{
109 #ifdef TO_FILE
110 if (NULL != sampler_elem->file_name)
111 {
112 GNUNET_free (sampler_elem->file_name);
113 }
114 #endif /* TO_FILE */
115 GNUNET_free (sampler_elem);
116}
117
118
119/**
102 * Input an PeerID into the given sampler element. 120 * Input an PeerID into the given sampler element.
103 * 121 *
104 * @param sampler the sampler the @a s_elem belongs to. 122 * @param sampler the sampler the @a s_elem belongs to.
@@ -112,9 +130,11 @@ RPS_sampler_elem_next (struct RPS_SamplerElement *s_elem,
112 130
113 s_elem->num_peers++; 131 s_elem->num_peers++;
114 132
133 #ifdef TO_FILE
115 to_file (s_elem->file_name, 134 to_file (s_elem->file_name,
116 "Got id %s", 135 "Got id %s",
117 GNUNET_i2s_full (other)); 136 GNUNET_i2s_full (other));
137 #endif /* TO_FILE */
118 138
119 if (0 == GNUNET_CRYPTO_cmp_peer_identity (other, &(s_elem->peer_id))) 139 if (0 == GNUNET_CRYPTO_cmp_peer_identity (other, &(s_elem->peer_id)))
120 { 140 {
@@ -155,9 +175,11 @@ RPS_sampler_elem_next (struct RPS_SamplerElement *s_elem,
155 } 175 }
156 s_elem->is_empty = NOT_EMPTY; 176 s_elem->is_empty = NOT_EMPTY;
157 177
178 #ifdef TO_FILE
158 to_file (s_elem->file_name, 179 to_file (s_elem->file_name,
159 "Now holding %s", 180 "Now holding %s",
160 GNUNET_i2s_full (&s_elem->peer_id)); 181 GNUNET_i2s_full (&s_elem->peer_id));
182 #endif /* TO_FILE */
161} 183}
162 184
163/** 185/**