diff options
author | Julius Bünger <buenger@mytum.de> | 2018-01-07 21:03:24 +0100 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2018-01-07 22:33:07 +0100 |
commit | 00a7c3ac1d01a8a4ff63e80675ea2fc6d7279636 (patch) | |
tree | e6b938eee983c768410ad9d065886ba4be2be570 | |
parent | c87570b26f307261f4522a2f5d42f11f2dd514f7 (diff) | |
download | gnunet-00a7c3ac1d01a8a4ff63e80675ea2fc6d7279636.tar.gz gnunet-00a7c3ac1d01a8a4ff63e80675ea2fc6d7279636.zip |
rps tests: make sure no callback executes after shutdown
-rw-r--r-- | src/rps/test_rps.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index e321cca09..1e8d4eb55 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c | |||
@@ -590,6 +590,11 @@ info_cb (void *cb_cls, | |||
590 | { | 590 | { |
591 | struct OpListEntry *entry = (struct OpListEntry *) cb_cls; | 591 | struct OpListEntry *entry = (struct OpListEntry *) cb_cls; |
592 | 592 | ||
593 | if (GNUNET_YES == in_shutdown) | ||
594 | { | ||
595 | return; | ||
596 | } | ||
597 | |||
593 | if (NULL == pinfo || NULL != emsg) | 598 | if (NULL == pinfo || NULL != emsg) |
594 | { | 599 | { |
595 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg); | 600 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Got Error: %s\n", emsg); |
@@ -639,6 +644,11 @@ rps_connect_complete_cb (void *cls, | |||
639 | struct RPSPeer *rps_peer = cls; | 644 | struct RPSPeer *rps_peer = cls; |
640 | struct GNUNET_RPS_Handle *rps = ca_result; | 645 | struct GNUNET_RPS_Handle *rps = ca_result; |
641 | 646 | ||
647 | if (GNUNET_YES == in_shutdown) | ||
648 | { | ||
649 | return; | ||
650 | } | ||
651 | |||
642 | rps_peer->rps_handle = rps; | 652 | rps_peer->rps_handle = rps; |
643 | rps_peer->online = GNUNET_YES; | 653 | rps_peer->online = GNUNET_YES; |
644 | num_peers_online++; | 654 | num_peers_online++; |
@@ -941,6 +951,11 @@ mal_cb (struct RPSPeer *rps_peer) | |||
941 | { | 951 | { |
942 | uint32_t num_mal_peers; | 952 | uint32_t num_mal_peers; |
943 | 953 | ||
954 | if (GNUNET_YES == in_shutdown) | ||
955 | { | ||
956 | return; | ||
957 | } | ||
958 | |||
944 | #ifdef ENABLE_MALICIOUS | 959 | #ifdef ENABLE_MALICIOUS |
945 | GNUNET_assert ( (1 >= portion) && | 960 | GNUNET_assert ( (1 >= portion) && |
946 | (0 < portion) ); | 961 | (0 < portion) ); |
@@ -963,6 +978,11 @@ mal_cb (struct RPSPeer *rps_peer) | |||
963 | static void | 978 | static void |
964 | single_req_cb (struct RPSPeer *rps_peer) | 979 | single_req_cb (struct RPSPeer *rps_peer) |
965 | { | 980 | { |
981 | if (GNUNET_YES == in_shutdown) | ||
982 | { | ||
983 | return; | ||
984 | } | ||
985 | |||
966 | schedule_missing_requests (rps_peer); | 986 | schedule_missing_requests (rps_peer); |
967 | } | 987 | } |
968 | 988 | ||
@@ -972,6 +992,11 @@ single_req_cb (struct RPSPeer *rps_peer) | |||
972 | static void | 992 | static void |
973 | delay_req_cb (struct RPSPeer *rps_peer) | 993 | delay_req_cb (struct RPSPeer *rps_peer) |
974 | { | 994 | { |
995 | if (GNUNET_YES == in_shutdown) | ||
996 | { | ||
997 | return; | ||
998 | } | ||
999 | |||
975 | schedule_missing_requests (rps_peer); | 1000 | schedule_missing_requests (rps_peer); |
976 | } | 1001 | } |
977 | 1002 | ||
@@ -981,6 +1006,11 @@ delay_req_cb (struct RPSPeer *rps_peer) | |||
981 | static void | 1006 | static void |
982 | seed_cb (struct RPSPeer *rps_peer) | 1007 | seed_cb (struct RPSPeer *rps_peer) |
983 | { | 1008 | { |
1009 | if (GNUNET_YES == in_shutdown) | ||
1010 | { | ||
1011 | return; | ||
1012 | } | ||
1013 | |||
984 | GNUNET_SCHEDULER_add_delayed ( | 1014 | GNUNET_SCHEDULER_add_delayed ( |
985 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), | 1015 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), |
986 | seed_peers, rps_peer); | 1016 | seed_peers, rps_peer); |
@@ -992,6 +1022,11 @@ seed_cb (struct RPSPeer *rps_peer) | |||
992 | static void | 1022 | static void |
993 | seed_big_cb (struct RPSPeer *rps_peer) | 1023 | seed_big_cb (struct RPSPeer *rps_peer) |
994 | { | 1024 | { |
1025 | if (GNUNET_YES == in_shutdown) | ||
1026 | { | ||
1027 | return; | ||
1028 | } | ||
1029 | |||
995 | // TODO test seeding > GNUNET_MAX_MESSAGE_SIZE peers | 1030 | // TODO test seeding > GNUNET_MAX_MESSAGE_SIZE peers |
996 | GNUNET_SCHEDULER_add_delayed ( | 1031 | GNUNET_SCHEDULER_add_delayed ( |
997 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), | 1032 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), |
@@ -1013,6 +1048,11 @@ single_peer_seed_cb (struct RPSPeer *rps_peer) | |||
1013 | static void | 1048 | static void |
1014 | seed_req_cb (struct RPSPeer *rps_peer) | 1049 | seed_req_cb (struct RPSPeer *rps_peer) |
1015 | { | 1050 | { |
1051 | if (GNUNET_YES == in_shutdown) | ||
1052 | { | ||
1053 | return; | ||
1054 | } | ||
1055 | |||
1016 | GNUNET_SCHEDULER_add_delayed ( | 1056 | GNUNET_SCHEDULER_add_delayed ( |
1017 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), | 1057 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2), |
1018 | seed_peers, rps_peer); | 1058 | seed_peers, rps_peer); |
@@ -1027,6 +1067,11 @@ seed_req_cb (struct RPSPeer *rps_peer) | |||
1027 | static void | 1067 | static void |
1028 | req_cancel_cb (struct RPSPeer *rps_peer) | 1068 | req_cancel_cb (struct RPSPeer *rps_peer) |
1029 | { | 1069 | { |
1070 | if (GNUNET_YES == in_shutdown) | ||
1071 | { | ||
1072 | return; | ||
1073 | } | ||
1074 | |||
1030 | schedule_missing_requests (rps_peer); | 1075 | schedule_missing_requests (rps_peer); |
1031 | GNUNET_SCHEDULER_add_delayed ( | 1076 | GNUNET_SCHEDULER_add_delayed ( |
1032 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 1077 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, |
@@ -1055,6 +1100,11 @@ churn (void *cls); | |||
1055 | static void | 1100 | static void |
1056 | churn_test_cb (struct RPSPeer *rps_peer) | 1101 | churn_test_cb (struct RPSPeer *rps_peer) |
1057 | { | 1102 | { |
1103 | if (GNUNET_YES == in_shutdown) | ||
1104 | { | ||
1105 | return; | ||
1106 | } | ||
1107 | |||
1058 | /* Start churn */ | 1108 | /* Start churn */ |
1059 | if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task) | 1109 | if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task) |
1060 | { | 1110 | { |
@@ -1091,6 +1141,11 @@ churn_cb (void *cls, | |||
1091 | // FIXME | 1141 | // FIXME |
1092 | struct OpListEntry *entry = cls; | 1142 | struct OpListEntry *entry = cls; |
1093 | 1143 | ||
1144 | if (GNUNET_YES == in_shutdown) | ||
1145 | { | ||
1146 | return; | ||
1147 | } | ||
1148 | |||
1094 | GNUNET_TESTBED_operation_done (entry->op); | 1149 | GNUNET_TESTBED_operation_done (entry->op); |
1095 | if (NULL != emsg) | 1150 | if (NULL != emsg) |
1096 | { | 1151 | { |
@@ -1212,6 +1267,10 @@ churn (void *cls) | |||
1212 | double portion_go_online; | 1267 | double portion_go_online; |
1213 | double portion_go_offline; | 1268 | double portion_go_offline; |
1214 | 1269 | ||
1270 | if (GNUNET_YES == in_shutdown) | ||
1271 | { | ||
1272 | return; | ||
1273 | } | ||
1215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1274 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1216 | "Churn function executing\n"); | 1275 | "Churn function executing\n"); |
1217 | 1276 | ||
@@ -1322,6 +1381,11 @@ profiler_reply_handle (void *cls, | |||
1322 | static void | 1381 | static void |
1323 | profiler_cb (struct RPSPeer *rps_peer) | 1382 | profiler_cb (struct RPSPeer *rps_peer) |
1324 | { | 1383 | { |
1384 | if (GNUNET_YES == in_shutdown) | ||
1385 | { | ||
1386 | return; | ||
1387 | } | ||
1388 | |||
1325 | /* Start churn */ | 1389 | /* Start churn */ |
1326 | if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task) | 1390 | if (GNUNET_YES == cur_test_run.have_churn && NULL == churn_task) |
1327 | { | 1391 | { |