size_t colon_pos;
int tsize;
struct GNUNET_PeerIdentity pid;
- struct stat frstat;
+ uint64_t fsize;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
unsigned int entries_found;
char *transport_name;
GNUNET_DISK_fn_write (fn, NULL, 0,
GNUNET_DISK_PERM_USER_READ |
GNUNET_DISK_PERM_USER_WRITE);
- if (0 != STAT (fn, &frstat))
+ if (GNUNET_OK != GNUNET_DISK_file_size (fn,
+ &fsize, GNUNET_NO, GNUNET_YES))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Could not read blacklist file `%s'\n"), fn);
GNUNET_free (fn);
return;
}
- if (frstat.st_size == 0)
+ if (fsize == 0)
{
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Blacklist file `%s' is empty.\n"),
return;
}
/* FIXME: use mmap */
- data = GNUNET_malloc_large (frstat.st_size);
+ data = GNUNET_malloc_large (fsize);
GNUNET_assert (data != NULL);
- if (frstat.st_size != GNUNET_DISK_fn_read (fn, data, frstat.st_size))
+ if (fsize != GNUNET_DISK_fn_read (fn, data, fsize))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Failed to read blacklist from `%s'\n"), fn);
}
entries_found = 0;
pos = 0;
- while ((pos < frstat.st_size) && isspace ((unsigned char) data[pos]))
+ while ((pos < fsize) && isspace ((unsigned char) data[pos]))
pos++;
- while ((frstat.st_size >= sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)) &&
+ while ((fsize >= sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)) &&
(pos <=
- frstat.st_size - sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)))
+ fsize - sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)))
{
colon_pos = pos;
- while ((colon_pos < frstat.st_size) && (data[colon_pos] != ':') &&
+ while ((colon_pos < fsize) && (data[colon_pos] != ':') &&
(!isspace ((unsigned char) data[colon_pos])))
colon_pos++;
- if (colon_pos >= frstat.st_size)
+ if (colon_pos >= fsize)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_
("Syntax error in blacklist file at offset %llu, skipping bytes.\n"),
(unsigned long long) colon_pos);
pos = colon_pos;
- while ((pos < frstat.st_size) && isspace ((unsigned char) data[pos]))
+ while ((pos < fsize) && isspace ((unsigned char) data[pos]))
pos++;
continue;
}
tsize = colon_pos - pos;
- if ((pos >= frstat.st_size) || (pos + tsize >= frstat.st_size) ||
+ if ((pos >= fsize) || (pos + tsize >= fsize) ||
(tsize == 0))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
("Syntax error in blacklist file at offset %llu, skipping bytes.\n"),
(unsigned long long) pos);
pos++;
- while ((pos < frstat.st_size) && (!isspace ((unsigned char) data[pos])))
+ while ((pos < fsize) && (!isspace ((unsigned char) data[pos])))
pos++;
GNUNET_free_non_null (transport_name);
continue;
}
pos = pos + sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded);
GNUNET_free_non_null (transport_name);
- while ((pos < frstat.st_size) && isspace ((unsigned char) data[pos]))
+ while ((pos < fsize) && isspace ((unsigned char) data[pos]))
pos++;
}
GNUNET_STATISTICS_update (GST_stats, "# Transport entries blacklisted",
GNUNET_i2s (&bc->peer));
#endif
bc->cont (bc->cont_cls, &bc->peer, GNUNET_OK);
+ GNUNET_CONTAINER_DLL_remove(bc_head, bc_tail, bc);
GNUNET_free (bc);
return;
}
* @param neighbour neighbour's identity
* @param ats performance data
* @param ats_count number of entries in ats (excluding 0-termination)
- * @param transport plugin
- * @param addr address
- * @param addrlen address length
+ * @param address the address
*/
static void
test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *neighbour,
const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count, const char *transport, const void *addr,
- size_t addrlen)
+ uint32_t ats_count,
+ const struct GNUNET_HELLO_Address *address)
{
struct TestConnectionContext *tcc = cls;
struct GST_BlacklistCheck *bc;
const char *transport_name = cls;
char *be = value;
+ /* blacklist check for specific no specific transport*/
+ if (transport_name == NULL)
+ return GNUNET_NO;
+
+ /* blacklist check for specific transport */
if (0 == strcmp (transport_name, be))
return GNUNET_NO; /* abort iteration! */
return GNUNET_OK;
{
struct GST_BlacklistCheck *bc;
+ GNUNET_assert (peer != NULL);
+
if ((blacklist != NULL) &&
(GNUNET_SYSERR ==
GNUNET_CONTAINER_multihashmap_get_multiple (blacklist, &peer->hashPubKey,