diff options
author | Markus Teich <markus.teich@stusta.mhn.de> | 2016-09-08 19:17:15 +0200 |
---|---|---|
committer | Markus Teich <markus.teich@stusta.mhn.de> | 2016-09-08 19:17:15 +0200 |
commit | 14546eccb205aa844657d2c350c83f6be1289b67 (patch) | |
tree | 8d081850e2ca5dd44b1e03d7ed39a61c487c9725 /test_brandt.c | |
parent | f294cd3a85c084490a10ae6ac9c1dab4c60a7678 (diff) | |
download | libbrandt-14546eccb205aa844657d2c350c83f6be1289b67.tar.gz libbrandt-14546eccb205aa844657d2c350c83f6be1289b67.zip |
test_brandt nearly done
Diffstat (limited to 'test_brandt.c')
-rw-r--r-- | test_brandt.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test_brandt.c b/test_brandt.c index 274762d..0c7e4e2 100644 --- a/test_brandt.c +++ b/test_brandt.c | |||
@@ -91,6 +91,7 @@ cb_broadcast (void *auction_closure, | |||
91 | { | 91 | { |
92 | uint16_t *s = (uint16_t *)auction_closure; | 92 | uint16_t *s = (uint16_t *)auction_closure; |
93 | struct msg *m; | 93 | struct msg *m; |
94 | |||
94 | for (uint16_t i = 0; i <= bidders; i++) | 95 | for (uint16_t i = 0; i <= bidders; i++) |
95 | { | 96 | { |
96 | if (i == *s) | 97 | if (i == *s) |
@@ -112,6 +113,18 @@ cb_unicast (void *auction_closure, | |||
112 | const void *msg, | 113 | const void *msg, |
113 | size_t msg_len) | 114 | size_t msg_len) |
114 | { | 115 | { |
116 | uint16_t *s = (uint16_t *)auction_closure; | ||
117 | struct msg *m; | ||
118 | |||
119 | m = GNUNET_new (struct msg); | ||
120 | m->sender = *s; | ||
121 | m->receiver = bidders; /* == seller */ | ||
122 | m->buf = GNUNET_new_array (msg_len, unsigned char); | ||
123 | memcpy (m->buf, msg, msg_len); | ||
124 | m->buf_len = msg_len; | ||
125 | GNUNET_SCHEDULER_add_now (&transfer_message, m); | ||
126 | |||
127 | return 0; | ||
115 | } | 128 | } |
116 | 129 | ||
117 | 130 | ||
@@ -145,7 +158,7 @@ run_new_join (void *arg) | |||
145 | GNUNET_TIME_UNIT_MINUTES, | 158 | GNUNET_TIME_UNIT_MINUTES, |
146 | prizes, /* amount of possible prizes */ | 159 | prizes, /* amount of possible prizes */ |
147 | 0, /* m */ | 160 | 0, /* m */ |
148 | 1); | 161 | 0); |
149 | if (!ad[bidders]) | 162 | if (!ad[bidders]) |
150 | { | 163 | { |
151 | weprintf ("BRANDT_new() failed."); | 164 | weprintf ("BRANDT_new() failed."); |