diff options
Diffstat (limited to 'src/core/test_core_api_mq.c')
-rw-r--r-- | src/core/test_core_api_mq.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/core/test_core_api_mq.c b/src/core/test_core_api_mq.c index a82465e74..8ece78e58 100644 --- a/src/core/test_core_api_mq.c +++ b/src/core/test_core_api_mq.c | |||
@@ -29,15 +29,15 @@ | |||
29 | /** | 29 | /** |
30 | * Has the test been successful? | 30 | * Has the test been successful? |
31 | */ | 31 | */ |
32 | int result; | 32 | static int result; |
33 | 33 | ||
34 | unsigned int num_received; | 34 | static unsigned int num_received; |
35 | 35 | ||
36 | struct GNUNET_CORE_Handle *core; | 36 | static struct GNUNET_CORE_Handle *core; |
37 | 37 | ||
38 | struct GNUNET_MQ_Handle *mq; | 38 | static struct GNUNET_MQ_Handle *mq; |
39 | 39 | ||
40 | struct GNUNET_PeerIdentity myself; | 40 | static struct GNUNET_PeerIdentity myself; |
41 | 41 | ||
42 | 42 | ||
43 | static void | 43 | static void |
@@ -55,15 +55,19 @@ init_cb (void *cls, | |||
55 | 55 | ||
56 | 56 | ||
57 | static void | 57 | static void |
58 | connect_cb (void *cls, const struct GNUNET_PeerIdentity *peer) | 58 | connect_cb (void *cls, |
59 | const struct GNUNET_PeerIdentity *peer) | ||
59 | { | 60 | { |
60 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected to peer %s.\n", | 61 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
62 | "Connected to peer %s.\n", | ||
61 | GNUNET_i2s (peer)); | 63 | GNUNET_i2s (peer)); |
62 | if (0 == memcmp (peer, &myself, sizeof (struct GNUNET_PeerIdentity))) | 64 | if (0 == memcmp (peer, &myself, sizeof (struct GNUNET_PeerIdentity))) |
63 | { | 65 | { |
64 | unsigned int i; | 66 | unsigned int i; |
65 | struct GNUNET_MQ_Envelope *ev; | 67 | struct GNUNET_MQ_Envelope *ev; |
66 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing messages.\n"); | 68 | |
69 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
70 | "Queueing messages.\n"); | ||
67 | for (i = 0; i < NUM_MSG; i++) | 71 | for (i = 0; i < NUM_MSG; i++) |
68 | { | 72 | { |
69 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_TEST); | 73 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_TEST); |
@@ -78,7 +82,9 @@ handle_test (void *cls, | |||
78 | const struct GNUNET_PeerIdentity *other, | 82 | const struct GNUNET_PeerIdentity *other, |
79 | const struct GNUNET_MessageHeader *message) | 83 | const struct GNUNET_MessageHeader *message) |
80 | { | 84 | { |
81 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got test message %d\n", num_received); | 85 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
86 | "Got test message %d\n", | ||
87 | num_received); | ||
82 | num_received++; | 88 | num_received++; |
83 | if (NUM_MSG == num_received) | 89 | if (NUM_MSG == num_received) |
84 | { | 90 | { |
@@ -98,7 +104,8 @@ handle_test (void *cls, | |||
98 | static void | 104 | static void |
99 | shutdown_task (void *cls) | 105 | shutdown_task (void *cls) |
100 | { | 106 | { |
101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutting down\n"); | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
108 | "Shutting down\n"); | ||
102 | GNUNET_MQ_destroy (mq); | 109 | GNUNET_MQ_destroy (mq); |
103 | GNUNET_CORE_disconnect (core); | 110 | GNUNET_CORE_disconnect (core); |
104 | } | 111 | } |
@@ -129,9 +136,10 @@ run (void *cls, | |||
129 | GNUNET_assert (0); | 136 | GNUNET_assert (0); |
130 | return; | 137 | return; |
131 | } | 138 | } |
132 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); | 139 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
133 | } | 140 | } |
134 | 141 | ||
142 | |||
135 | int | 143 | int |
136 | main (int argc, char *argv1[]) | 144 | main (int argc, char *argv1[]) |
137 | { | 145 | { |