diff options
-rw-r--r-- | src/testing/test_testing.c | 14 | ||||
-rw-r--r-- | src/testing/testing_group.c | 17 |
2 files changed, 12 insertions, 19 deletions
diff --git a/src/testing/test_testing.c b/src/testing/test_testing.c index 880ecb399..30ad9b13d 100644 --- a/src/testing/test_testing.c +++ b/src/testing/test_testing.c | |||
@@ -48,6 +48,17 @@ end_cb (void *cls, const char *emsg) | |||
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | |||
52 | |||
53 | void do_shutdown (void *cls, | ||
54 | const struct GNUNET_SCHEDULER_TaskContext * tc) | ||
55 | { | ||
56 | struct GNUNET_TESTING_Daemon *d = cls; | ||
57 | GNUNET_TESTING_daemon_stop (d, TIMEOUT, &end_cb, NULL, GNUNET_YES, | ||
58 | GNUNET_NO); | ||
59 | } | ||
60 | |||
61 | |||
51 | static void | 62 | static void |
52 | my_cb (void *cls, | 63 | my_cb (void *cls, |
53 | const struct GNUNET_PeerIdentity *id, | 64 | const struct GNUNET_PeerIdentity *id, |
@@ -59,8 +70,7 @@ my_cb (void *cls, | |||
59 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 70 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
60 | "Daemon `%s' started, will now stop it.\n", GNUNET_i2s (id)); | 71 | "Daemon `%s' started, will now stop it.\n", GNUNET_i2s (id)); |
61 | #endif | 72 | #endif |
62 | GNUNET_TESTING_daemon_stop (d, TIMEOUT, &end_cb, NULL, GNUNET_YES, | 73 | GNUNET_SCHEDULER_add_now(&do_shutdown, d); |
63 | GNUNET_NO); | ||
64 | } | 74 | } |
65 | 75 | ||
66 | 76 | ||
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 10aa31770..14bf31bbc 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -42,7 +42,6 @@ | |||
42 | 42 | ||
43 | #define TOPOLOGY_HACK GNUNET_YES | 43 | #define TOPOLOGY_HACK GNUNET_YES |
44 | 44 | ||
45 | #define AVOID_CONN_MALLOC GNUNET_NO | ||
46 | 45 | ||
47 | /** | 46 | /** |
48 | * Lowest port used for GNUnet testing. Should be high enough to not | 47 | * Lowest port used for GNUnet testing. Should be high enough to not |
@@ -784,12 +783,6 @@ struct GNUNET_TESTING_PeerGroup | |||
784 | * Connection context for peer group. | 783 | * Connection context for peer group. |
785 | */ | 784 | */ |
786 | struct ConnectTopologyContext ct_ctx; | 785 | struct ConnectTopologyContext ct_ctx; |
787 | |||
788 | #if AVOID_CONN_MALLOC | ||
789 | struct PeerConnection working_peer_connections[200000]; | ||
790 | |||
791 | unsigned int current_peer_connection; | ||
792 | #endif | ||
793 | }; | 786 | }; |
794 | 787 | ||
795 | struct UpdateContext | 788 | struct UpdateContext |
@@ -1649,12 +1642,7 @@ add_connections(struct GNUNET_TESTING_PeerGroup *pg, unsigned int first, | |||
1649 | added = 0; | 1642 | added = 0; |
1650 | if (add_first) | 1643 | if (add_first) |
1651 | { | 1644 | { |
1652 | #if AVOID_CONN_MALLOC | ||
1653 | new_first = &pg->working_peer_connections[pg->current_peer_connection]; | ||
1654 | pg->current_peer_connection++; | ||
1655 | #else | ||
1656 | new_first = GNUNET_malloc (sizeof (struct PeerConnection)); | 1645 | new_first = GNUNET_malloc (sizeof (struct PeerConnection)); |
1657 | #endif | ||
1658 | new_first->index = second; | 1646 | new_first->index = second; |
1659 | GNUNET_CONTAINER_DLL_insert(*first_list, *first_tail, new_first); | 1647 | GNUNET_CONTAINER_DLL_insert(*first_list, *first_tail, new_first); |
1660 | pg->peers[first].num_connections++; | 1648 | pg->peers[first].num_connections++; |
@@ -1663,12 +1651,7 @@ add_connections(struct GNUNET_TESTING_PeerGroup *pg, unsigned int first, | |||
1663 | 1651 | ||
1664 | if (add_second) | 1652 | if (add_second) |
1665 | { | 1653 | { |
1666 | #if AVOID_CONN_MALLOC | ||
1667 | new_second = &pg->working_peer_connections[pg->current_peer_connection]; | ||
1668 | pg->current_peer_connection++; | ||
1669 | #else | ||
1670 | new_second = GNUNET_malloc (sizeof (struct PeerConnection)); | 1654 | new_second = GNUNET_malloc (sizeof (struct PeerConnection)); |
1671 | #endif | ||
1672 | new_second->index = first; | 1655 | new_second->index = first; |
1673 | GNUNET_CONTAINER_DLL_insert(*second_list, *second_tail, new_second); | 1656 | GNUNET_CONTAINER_DLL_insert(*second_list, *second_tail, new_second); |
1674 | pg->peers[second].num_connections++; | 1657 | pg->peers[second].num_connections++; |