diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/core/test_core_api_start_only.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/core/test_core_api_start_only.c')
-rw-r--r-- | src/core/test_core_api_start_only.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 36d964796..ca301f51e 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -66,8 +66,7 @@ static int ok; | |||
66 | 66 | ||
67 | 67 | ||
68 | static void | 68 | static void |
69 | connect_notify (void *cls, | 69 | connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, |
70 | const struct GNUNET_PeerIdentity *peer, | ||
71 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 70 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
72 | { | 71 | { |
73 | } | 72 | } |
@@ -80,8 +79,7 @@ disconnect_notify (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
80 | 79 | ||
81 | 80 | ||
82 | static int | 81 | static int |
83 | inbound_notify (void *cls, | 82 | inbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, |
84 | const struct GNUNET_PeerIdentity *other, | ||
85 | const struct GNUNET_MessageHeader *message, | 83 | const struct GNUNET_MessageHeader *message, |
86 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 84 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
87 | { | 85 | { |
@@ -90,8 +88,7 @@ inbound_notify (void *cls, | |||
90 | 88 | ||
91 | 89 | ||
92 | static int | 90 | static int |
93 | outbound_notify (void *cls, | 91 | outbound_notify (void *cls, const struct GNUNET_PeerIdentity *other, |
94 | const struct GNUNET_PeerIdentity *other, | ||
95 | const struct GNUNET_MessageHeader *message, | 92 | const struct GNUNET_MessageHeader *message, |
96 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) | 93 | const struct GNUNET_TRANSPORT_ATS_Information *atsi) |
97 | { | 94 | { |
@@ -118,8 +115,7 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
118 | 115 | ||
119 | 116 | ||
120 | static void | 117 | static void |
121 | init_notify (void *cls, | 118 | init_notify (void *cls, struct GNUNET_CORE_Handle *server, |
122 | struct GNUNET_CORE_Handle *server, | ||
123 | const struct GNUNET_PeerIdentity *my_identity, | 119 | const struct GNUNET_PeerIdentity *my_identity, |
124 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) | 120 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey) |
125 | { | 121 | { |
@@ -130,15 +126,11 @@ init_notify (void *cls, | |||
130 | if (cls == &p1) | 126 | if (cls == &p1) |
131 | { | 127 | { |
132 | /* connect p2 */ | 128 | /* connect p2 */ |
133 | p2.ch = GNUNET_CORE_connect (p2.cfg, 1, | 129 | p2.ch = |
134 | &p2, | 130 | GNUNET_CORE_connect (p2.cfg, 1, &p2, &init_notify, &connect_notify, |
135 | &init_notify, | 131 | &disconnect_notify, NULL, &inbound_notify, |
136 | &connect_notify, | 132 | GNUNET_YES, &outbound_notify, GNUNET_YES, |
137 | &disconnect_notify, | 133 | handlers); |
138 | NULL, | ||
139 | &inbound_notify, | ||
140 | GNUNET_YES, | ||
141 | &outbound_notify, GNUNET_YES, handlers); | ||
142 | } | 134 | } |
143 | else | 135 | else |
144 | { | 136 | { |
@@ -154,12 +146,13 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
154 | { | 146 | { |
155 | p->cfg = GNUNET_CONFIGURATION_create (); | 147 | p->cfg = GNUNET_CONFIGURATION_create (); |
156 | #if START_ARM | 148 | #if START_ARM |
157 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 149 | p->arm_proc = |
158 | "gnunet-service-arm", | 150 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
151 | "gnunet-service-arm", | ||
159 | #if VERBOSE | 152 | #if VERBOSE |
160 | "-L", "DEBUG", | 153 | "-L", "DEBUG", |
161 | #endif | 154 | #endif |
162 | "-c", cfgname, NULL); | 155 | "-c", cfgname, NULL); |
163 | #endif | 156 | #endif |
164 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 157 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
165 | } | 158 | } |
@@ -185,9 +178,8 @@ timeout_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
185 | 178 | ||
186 | 179 | ||
187 | static void | 180 | static void |
188 | run (void *cls, | 181 | run (void *cls, char *const *args, const char *cfgfile, |
189 | char *const *args, | 182 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
190 | const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
191 | { | 183 | { |
192 | GNUNET_assert (ok == 1); | 184 | GNUNET_assert (ok == 1); |
193 | OKPP; | 185 | OKPP; |
@@ -213,8 +205,7 @@ stop_arm (struct PeerContext *p) | |||
213 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); | 205 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); |
214 | if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) | 206 | if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) |
215 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); | 207 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); |
216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 208 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n", |
217 | "ARM process %u stopped\n", | ||
218 | GNUNET_OS_process_get_pid (p->arm_proc)); | 209 | GNUNET_OS_process_get_pid (p->arm_proc)); |
219 | GNUNET_OS_process_close (p->arm_proc); | 210 | GNUNET_OS_process_close (p->arm_proc); |
220 | p->arm_proc = NULL; | 211 | p->arm_proc = NULL; |
@@ -241,9 +232,8 @@ check () | |||
241 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2"); | 232 | GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2"); |
242 | 233 | ||
243 | ok = 1; | 234 | ok = 1; |
244 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, | 235 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
245 | argv, "test-core-api-start-only", "nohelp", options, &run, | 236 | "test-core-api-start-only", "nohelp", options, &run, &ok); |
246 | &ok); | ||
247 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test finished\n"); | 237 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test finished\n"); |
248 | stop_arm (&p1); | 238 | stop_arm (&p1); |
249 | stop_arm (&p2); | 239 | stop_arm (&p2); |