use fflush for stdout; minor changes
This commit is contained in:
parent
6bda23fb38
commit
a423fdb1d0
26
replay.c
26
replay.c
@ -31,8 +31,6 @@
|
|||||||
#include "crypto.h"
|
#include "crypto.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
|
||||||
|
|
||||||
struct msg
|
struct msg
|
||||||
{
|
{
|
||||||
uint16_t sender;
|
uint16_t sender;
|
||||||
@ -112,11 +110,20 @@ print_result( struct transcript *tr,
|
|||||||
"winners",
|
"winners",
|
||||||
results));
|
results));
|
||||||
|
|
||||||
json_dumpfd(output, 1, JSON_INDENT(2));
|
{
|
||||||
|
FILE *f = fdopen (1, "w");
|
||||||
|
GNUNET_assert(f);
|
||||||
|
|
||||||
|
json_dumpf (output, f, JSON_INDENT (2));
|
||||||
|
fflush (f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
json_decref (output);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tr_result (void *arg,
|
cb_result (void *arg,
|
||||||
struct BRANDT_Result results[],
|
struct BRANDT_Result results[],
|
||||||
uint16_t results_len)
|
uint16_t results_len)
|
||||||
{
|
{
|
||||||
@ -149,14 +156,13 @@ tr_result (void *arg,
|
|||||||
tr->expected[i].price);
|
tr->expected[i].price);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: compare computed and expected results!
|
|
||||||
|
|
||||||
print_result (tr, NULL);
|
print_result (tr, NULL);
|
||||||
|
// TODO: compare computed and expected results!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint16_t
|
static uint16_t
|
||||||
tr_start (void *auction_closure)
|
cb_start (void *auction_closure)
|
||||||
{
|
{
|
||||||
struct transcript *tr = (struct transcript *) auction_closure;
|
struct transcript *tr = (struct transcript *) auction_closure;
|
||||||
struct cls
|
struct cls
|
||||||
@ -200,9 +206,9 @@ replay_transcript (void *arg)
|
|||||||
"REPLAY calling BRANDT_new with %s outcome.\n",
|
"REPLAY calling BRANDT_new with %s outcome.\n",
|
||||||
tr->public ? "public" : "private");
|
tr->public ? "public" : "private");
|
||||||
|
|
||||||
tr->auction = BRANDT_new (&tr_result,
|
tr->auction = BRANDT_new (&cb_result,
|
||||||
NULL,
|
NULL,
|
||||||
&tr_start,
|
&cb_start,
|
||||||
tr,
|
tr,
|
||||||
&desc,
|
&desc,
|
||||||
&desc_len,
|
&desc_len,
|
||||||
@ -217,7 +223,6 @@ replay_transcript (void *arg)
|
|||||||
print_result (NULL, "REPLAY BRANDT_new() failed.");
|
print_result (NULL, "REPLAY BRANDT_new() failed.");
|
||||||
_exit (1);
|
_exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -451,6 +456,7 @@ main (int argc, char *argv[])
|
|||||||
tr.edc = GNUNET_CRYPTO_ecc_dlog_prepare (1024 * 1024 * 40, 1024);
|
tr.edc = GNUNET_CRYPTO_ecc_dlog_prepare (1024 * 1024 * 40, 1024);
|
||||||
GNUNET_SCHEDULER_run (&replay_transcript, &tr);
|
GNUNET_SCHEDULER_run (&replay_transcript, &tr);
|
||||||
GNUNET_CRYPTO_ecc_dlog_release (tr.edc);
|
GNUNET_CRYPTO_ecc_dlog_release (tr.edc);
|
||||||
|
GNUNET_free (tr.msgs);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user