diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-08-17 17:37:56 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-08-17 17:37:56 +0200 |
commit | ec43082b1adfa394184900d49f5fe816dba749ec (patch) | |
tree | 2c542044512484a9a29e15d1cfb9c3fef7129cb6 /brandt.c | |
parent | 6eb35ae72f4e579bd094f630b6b9d3d042432ae3 (diff) | |
download | libbrandt-ec43082b1adfa394184900d49f5fe816dba749ec.tar.gz libbrandt-ec43082b1adfa394184900d49f5fe816dba749ec.zip |
add start callback and further basic tests
Diffstat (limited to 'brandt.c')
-rw-r--r-- | brandt.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -60,8 +60,9 @@ start_auction (void *arg) | |||
60 | 60 | ||
61 | 61 | ||
62 | struct BRANDT_Auction * | 62 | struct BRANDT_Auction * |
63 | BRANDT_new (BRANDT_CbBroadcast broadcast, | 63 | BRANDT_new (BRANDT_CbResult result, |
64 | BRANDT_CbResult result, | 64 | BRANDT_CbBroadcast broadcast, |
65 | BRANDT_CbStart start, | ||
65 | void *auction_closure, | 66 | void *auction_closure, |
66 | void **auction_desc, | 67 | void **auction_desc, |
67 | size_t *auction_desc_len, | 68 | size_t *auction_desc_len, |
@@ -97,7 +98,7 @@ BRANDT_new (BRANDT_CbBroadcast broadcast, | |||
97 | ret->k = num_prices; | 98 | ret->k = num_prices; |
98 | ret->m = m; | 99 | ret->m = m; |
99 | ret->outcome_public = outcome_public; | 100 | ret->outcome_public = outcome_public; |
100 | ret->cur_round = msg_join; | 101 | ret->cur_round = msg_init; |
101 | ret->round_progress = gcry_mpi_new (256); | 102 | ret->round_progress = gcry_mpi_new (256); |
102 | 103 | ||
103 | /* we are the seller */ | 104 | /* we are the seller */ |
@@ -107,9 +108,9 @@ BRANDT_new (BRANDT_CbBroadcast broadcast, | |||
107 | ret->closure = auction_closure; | 108 | ret->closure = auction_closure; |
108 | ret->bcast = broadcast; | 109 | ret->bcast = broadcast; |
109 | ret->result = result; | 110 | ret->result = result; |
111 | ret->start = start; | ||
110 | 112 | ||
111 | until_start = GNUNET_TIME_absolute_get_remaining (time_start); | 113 | until_start = GNUNET_TIME_absolute_get_remaining (time_start); |
112 | /* \todo: store returned task somewhere to cancel it on shutdown */ | ||
113 | ret->task = GNUNET_SCHEDULER_add_delayed (until_start, | 114 | ret->task = GNUNET_SCHEDULER_add_delayed (until_start, |
114 | &start_auction, | 115 | &start_auction, |
115 | ret); | 116 | ret); |
@@ -178,9 +179,9 @@ BRANDT_verify_desc (const void *auction_desc, | |||
178 | 179 | ||
179 | 180 | ||
180 | struct BRANDT_Auction * | 181 | struct BRANDT_Auction * |
181 | BRANDT_join (BRANDT_CbBroadcast broadcast, | 182 | BRANDT_join (BRANDT_CbResult result, |
183 | BRANDT_CbBroadcast broadcast, | ||
182 | BRANDT_CbUnicast unicast, | 184 | BRANDT_CbUnicast unicast, |
183 | BRANDT_CbResult result, | ||
184 | void *auction_closure, | 185 | void *auction_closure, |
185 | const void *auction_desc, | 186 | const void *auction_desc, |
186 | size_t auction_desc_len, | 187 | size_t auction_desc_len, |
@@ -202,7 +203,7 @@ BRANDT_join (BRANDT_CbBroadcast broadcast, | |||
202 | weprintf ("failed to parse auction description blob"); | 203 | weprintf ("failed to parse auction description blob"); |
203 | return NULL; | 204 | return NULL; |
204 | } | 205 | } |
205 | ret->cur_round = msg_join; | 206 | ret->cur_round = msg_init; |
206 | ret->round_progress = gcry_mpi_new (256); | 207 | ret->round_progress = gcry_mpi_new (256); |
207 | 208 | ||
208 | /* we are the seller */ | 209 | /* we are the seller */ |