aboutsummaryrefslogtreecommitdiff
path: root/brandt.c
diff options
context:
space:
mode:
authorMarkus Teich <markus.teich@stusta.mhn.de>2016-12-02 09:34:25 +0100
committerMarkus Teich <markus.teich@stusta.mhn.de>2016-12-02 09:34:25 +0100
commit56b43dab7ff80acc4cd0e7ad3057abd5e6bad680 (patch)
tree74b6a5f1ff6f8994582926112b4102574784f524 /brandt.c
parentaee7167739e666ea94c3b68c58a0f7aa1ede238e (diff)
migrate to GNUNET_log
Diffstat (limited to 'brandt.c')
-rw-r--r--brandt.c60
1 files changed, 44 insertions, 16 deletions
diff --git a/brandt.c b/brandt.c
index 5a75eda..86239a8 100644
--- a/brandt.c
+++ b/brandt.c
@@ -37,13 +37,18 @@ BRANDT_init (struct GNUNET_CRYPTO_EccDlogContext *dlogctx)
/* SECMEM cannot be resized dynamically. We do not know how much we need */
if ((err = gcry_control (GCRYCTL_DISABLE_SECMEM, 0)))
- weprintf ("failed to set libgcrypt option DISABLE_SECMEM: %s",
- gcry_strerror (err));
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "failed to set libgcrypt option DISABLE_SECMEM: %s\n",
+ gcry_strerror (err));
/* ecc is slow otherwise and we don't create long term keys anyway. */
if ((err = gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0)))
- weprintf ("failed to set libgcrypt option ENABLE_QUICK_RANDOM: %s",
- gcry_strerror (err));
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "failed to set libgcrypt option ENABLE_QUICK_RANDOM: %s\n",
+ gcry_strerror (err));
gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
brandt_crypto_init (dlogctx);
@@ -110,7 +115,9 @@ BRANDT_bidder_start (struct BRANDT_Auction *auction,
!(buf = handler_out[atype][outcome][msg_init](auction, &buflen)))
{
/** \todo */
- weprintf ("wow fail out");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "wow fail out\n");
return;
}
@@ -132,7 +139,9 @@ seller_start (void *arg)
ad->n = ad->start (ad->closure);
if (0 == ad->n)
{
- weprintf ("no bidders registered for auction");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+ "libbrandt",
+ "no bidders registered for auction\n");
ad->result (ad->closure, NULL, 0);
return;
}
@@ -141,7 +150,9 @@ seller_start (void *arg)
struct BRANDT_Result *res = GNUNET_new_array (ad->n,
struct BRANDT_Result);
- weprintf ("less bidders than needed, selling for lowest price");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_INFO,
+ "libbrandt",
+ "less bidders than needed, selling for lowest price\n");
for (uint16_t i = 0; i < ad->n; i++)
{
res[i].bidder = i;
@@ -237,13 +248,17 @@ BRANDT_parse_desc (const void *auction_desc,
if (sizeof (struct BRANDT_DescrP) != auction_desc_len)
{
- weprintf ("auction desc struct size mismatch");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "auction desc struct size mismatch\n");
return -1;
}
if (0 != memcmp (&desc->reserved, &zero, sizeof (desc->reserved)))
{
- weprintf ("reserved field in auction description must be zero");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "reserved field in auction description must be zero\n");
return -1;
}
@@ -282,7 +297,9 @@ BRANDT_join (BRANDT_CbResult result,
&ret->outcome_public))
{
GNUNET_free (ret);
- weprintf ("failed to parse auction description blob");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "failed to parse auction description blob\n");
return NULL;
}
ret->cur_round = msg_init;
@@ -378,8 +395,10 @@ advance_round (struct BRANDT_Auction *ad,
if (!handler_out[atype][outcome][ad->cur_round] ||
!(buf = handler_out[atype][outcome][ad->cur_round](ad, &buflen)))
{
- weprintf ("failed to create msg %d buffer as seller",
- ad->cur_round);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "failed to create msg %d buffer as seller\n",
+ ad->cur_round);
return;
}
ad->bcast (ad->closure, buf, buflen);
@@ -410,7 +429,10 @@ advance_round (struct BRANDT_Auction *ad,
if (!handler_out[atype][outcome][ad->cur_round] ||
!(buf = handler_out[atype][outcome][ad->cur_round](ad, &buflen)))
{
- weprintf ("failed to create msg %d buffer as bidder", ad->cur_round);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "failed to create msg %d buffer as bidder\n",
+ ad->cur_round);
return;
}
@@ -441,14 +463,18 @@ BRANDT_got_message (struct BRANDT_Auction *auction,
/** \todo: cache out of order messages instead of discarding */
if (ntohl (head->msg_type) != round || ntohl (head->prot_version) != 0)
{
- weprintf ("got unexpected message, ignoring...");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "got unexpected message, ignoring...\n");
return;
}
/* check if we already got that round message from the same user */
if (gcry_mpi_test_bit (auction->round_progress, sender))
{
- weprintf ("got a duplicate message from user %d", sender);
+ GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
+ "libbrandt",
+ "got a duplicate message from user %d\n", sender);
return;
}
@@ -459,7 +485,9 @@ BRANDT_got_message (struct BRANDT_Auction *auction,
sender))
{
/** \todo */
- weprintf ("wow fail in");
+ GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR,
+ "libbrandt",
+ "wow fail in\n");
return;
}
gcry_mpi_set_bit (auction->round_progress, sender);