aboutsummaryrefslogtreecommitdiff
path: root/src/core/test_core_api_start_only.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/core/test_core_api_start_only.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-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.c48
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
68static void 68static void
69connect_notify (void *cls, 69connect_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
82static int 81static int
83inbound_notify (void *cls, 82inbound_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
92static int 90static int
93outbound_notify (void *cls, 91outbound_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
120static void 117static void
121init_notify (void *cls, 118init_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
187static void 180static void
188run (void *cls, 181run (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);