/**
- * (Re)Initialise given Sampler with random min-wise independent function.
+ * Create a sampler element and initialise it.
*
* In this implementation this means choosing an auth_key for later use in
* a hmac at random.
}
+/**
+ * Destroy a sampler element.
+ *
+ * @param sampler_elem the element to destroy
+ */
+void
+RPS_sampler_elem_destroy (struct RPS_SamplerElement *sampler_elem)
+{
+ #ifdef TO_FILE
+ if (NULL != sampler_elem->file_name)
+ {
+ GNUNET_free (sampler_elem->file_name);
+ }
+ #endif /* TO_FILE */
+ GNUNET_free (sampler_elem);
+}
+
+
/**
* Input an PeerID into the given sampler element.
*
s_elem->num_peers++;
+ #ifdef TO_FILE
to_file (s_elem->file_name,
"Got id %s",
GNUNET_i2s_full (other));
+ #endif /* TO_FILE */
if (0 == GNUNET_CRYPTO_cmp_peer_identity (other, &(s_elem->peer_id)))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
- GNUNET_i2s (other));
LOG (GNUNET_ERROR_TYPE_DEBUG, "Have already PeerID %s\n",
GNUNET_i2s (&(s_elem->peer_id)));
}
}
else if (0 > GNUNET_CRYPTO_hash_cmp (&other_hash, &s_elem->peer_id_hash))
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
- GNUNET_i2s (other));
LOG (GNUNET_ERROR_TYPE_DEBUG, "Discarding old PeerID %s\n",
GNUNET_i2s (&s_elem->peer_id));
s_elem->peer_id = *other;
}
else
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, " Got PeerID %s\n",
- GNUNET_i2s (other));
LOG (GNUNET_ERROR_TYPE_DEBUG, "Keeping old PeerID %s\n",
GNUNET_i2s (&s_elem->peer_id));
}
}
s_elem->is_empty = NOT_EMPTY;
+ #ifdef TO_FILE
to_file (s_elem->file_name,
"Now holding %s",
GNUNET_i2s_full (&s_elem->peer_id));
+ #endif /* TO_FILE */
}
/**