diff options
author | Julius Bünger <buenger@mytum.de> | 2018-01-07 22:05:52 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-01-07 22:33:08 +0100 |
commit | 92b5bc1b168adda55e192f5b5faba8a13874f38b (patch) | |
tree | a7dd1619d24431cba951110f15128912da491809 /src/rps/test_rps.c | |
parent | 00a7c3ac1d01a8a4ff63e80675ea2fc6d7279636 (diff) | |
download | gnunet-92b5bc1b168adda55e192f5b5faba8a13874f38b.tar.gz gnunet-92b5bc1b168adda55e192f5b5faba8a13874f38b.zip |
rps tests: check whether peer was scheduled to go off/online
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r-- | src/rps/test_rps.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 1e8d4eb55..992b4dc54 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -218,6 +218,11 @@ struct RPSPeer | |||
218 | * Number of received PeerIDs | 218 | * Number of received PeerIDs |
219 | */ | 219 | */ |
220 | unsigned int num_recv_ids; | 220 | unsigned int num_recv_ids; |
221 | |||
222 | /** | ||
223 | * Pending operation on that peer | ||
224 | */ | ||
225 | const struct OpListEntry *entry_op_manage; | ||
221 | }; | 226 | }; |
222 | 227 | ||
223 | 228 | ||
@@ -1200,6 +1205,7 @@ churn_cb (void *cls, | |||
1200 | } | 1205 | } |
1201 | 1206 | ||
1202 | GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry); | 1207 | GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry); |
1208 | rps_peers[entry->index].entry_op_manage = NULL; | ||
1203 | GNUNET_free (entry); | 1209 | GNUNET_free (entry); |
1204 | //if (num_peers_in_round[current_round] == peers_running) | 1210 | //if (num_peers_in_round[current_round] == peers_running) |
1205 | // run_round (); | 1211 | // run_round (); |
@@ -1222,6 +1228,14 @@ manage_service_wrapper (unsigned int i, unsigned int j, int delta, | |||
1222 | struct OpListEntry *entry; | 1228 | struct OpListEntry *entry; |
1223 | uint32_t prob; | 1229 | uint32_t prob; |
1224 | 1230 | ||
1231 | GNUNET_assert (GNUNET_YES == rps_peers[j].online); | ||
1232 | |||
1233 | /* make sure that management operation is not already scheduled */ | ||
1234 | if (NULL != rps_peers[j].entry_op_manage) | ||
1235 | { | ||
1236 | return; | ||
1237 | } | ||
1238 | |||
1225 | prob = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 1239 | prob = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
1226 | UINT32_MAX); | 1240 | UINT32_MAX); |
1227 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1253,6 +1267,7 @@ manage_service_wrapper (unsigned int i, unsigned int j, int delta, | |||
1253 | entry, | 1267 | entry, |
1254 | (0 > delta) ? 0 : 1); | 1268 | (0 > delta) ? 0 : 1); |
1255 | } | 1269 | } |
1270 | rps_peers[j].entry_op_manage = entry; | ||
1256 | } | 1271 | } |
1257 | 1272 | ||
1258 | 1273 | ||