+ {
+ GNUNET_asprintf (&pfn, "%s.%s", fn, plugin_name);
+ if (GNUNET_YES == GNUNET_DISK_file_test (pfn))
+ {
+ filter = GNUNET_CONTAINER_bloomfilter_load (pfn, bf_size, 5); /* approx. 3% false positives at max use */
+ if (NULL == filter)
+ {
+ /* file exists but not valid, remove and try again, but refresh */
+ if (0 != UNLINK (pfn))
+ {
+ /* failed to remove, run without file */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to remove bogus bloomfilter file `%s'\n"),
+ pfn);
+ GNUNET_free (pfn);
+ pfn = NULL;
+ filter = GNUNET_CONTAINER_bloomfilter_load (NULL, bf_size, 5); /* approx. 3% false positives at max use */
+ refresh_bf = GNUNET_YES;
+ }
+ else
+ {
+ /* try again after remove */
+ filter = GNUNET_CONTAINER_bloomfilter_load (pfn, bf_size, 5); /* approx. 3% false positives at max use */
+ refresh_bf = GNUNET_YES;
+ if (NULL == filter)
+ {
+ /* failed yet again, give up on using file */
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Failed to remove bogus bloomfilter file `%s'\n"),
+ pfn);
+ GNUNET_free (pfn);
+ pfn = NULL;
+ filter = GNUNET_CONTAINER_bloomfilter_load (NULL, bf_size, 5); /* approx. 3% false positives at max use */
+ }
+ }
+ }
+ else
+ {
+ /* normal case: have an existing valid bf file, no need to refresh */
+ refresh_bf = GNUNET_NO;
+ }
+ }
+ else
+ {
+ filter = GNUNET_CONTAINER_bloomfilter_load (pfn, bf_size, 5); /* approx. 3% false positives at max use */
+ refresh_bf = GNUNET_YES;
+ }
+ GNUNET_free (pfn);
+ }