aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/test_gnunet_daemon_hostlist_reconnect.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/hostlist/test_gnunet_daemon_hostlist_reconnect.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist_reconnect.c')
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index d1227da4c..ff625cf8e 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -96,8 +96,7 @@ timeout_error (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96 * @param distance in overlay hops, as given by transport plugin 96 * @param distance in overlay hops, as given by transport plugin
97 */ 97 */
98static void 98static void
99notify_connect (void *cls, 99notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
100 const struct GNUNET_PeerIdentity *peer,
101 const struct GNUNET_TRANSPORT_ATS_Information *ats, 100 const struct GNUNET_TRANSPORT_ATS_Information *ats,
102 uint32_t ats_count) 101 uint32_t ats_count)
103{ 102{
@@ -133,16 +132,17 @@ setup_peer (struct PeerContext *p, const char *cfgname)
133{ 132{
134 p->cfg = GNUNET_CONFIGURATION_create (); 133 p->cfg = GNUNET_CONFIGURATION_create ();
135#if START_ARM 134#if START_ARM
136 p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", 135 p->arm_proc =
137 "gnunet-service-arm", 136 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
137 "gnunet-service-arm",
138#if VERBOSE 138#if VERBOSE
139 "-L", "DEBUG", 139 "-L", "DEBUG",
140#endif 140#endif
141 "-c", cfgname, NULL); 141 "-c", cfgname, NULL);
142#endif 142#endif
143 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 143 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
144 p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, 144 p->th =
145 &notify_connect, NULL); 145 GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, &notify_connect, NULL);
146 GNUNET_assert (p->th != NULL); 146 GNUNET_assert (p->th != NULL);
147 GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p); 147 GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
148} 148}
@@ -159,8 +159,7 @@ waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
159 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 159 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
160 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK) 160 if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
161 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid"); 161 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
163 "ARM process %u stopped\n",
164 GNUNET_OS_process_get_pid (p->arm_proc)); 163 GNUNET_OS_process_get_pid (p->arm_proc));
165 GNUNET_OS_process_close (p->arm_proc); 164 GNUNET_OS_process_close (p->arm_proc);
166 p->arm_proc = NULL; 165 p->arm_proc = NULL;
@@ -189,15 +188,14 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
189 188
190 189
191static void 190static void
192run (void *cls, 191run (void *cls, char *const *args, const char *cfgfile,
193 char *const *args, 192 const struct GNUNET_CONFIGURATION_Handle *cfg)
194 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
195{ 193{
196 GNUNET_assert (ok == 1); 194 GNUNET_assert (ok == 1);
197 ok++; 195 ok++;
198 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_error, NULL); 196 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_error, NULL);
199 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 197 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
200 &shutdown_task, NULL); 198 NULL);
201 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); 199 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf");
202 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); 200 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf");
203} 201}
@@ -217,9 +215,9 @@ check ()
217 GNUNET_GETOPT_OPTION_END 215 GNUNET_GETOPT_OPTION_END
218 }; 216 };
219 ok = 1; 217 ok = 1;
220 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 218 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
221 argv, "test-gnunet-daemon-hostlist", 219 "test-gnunet-daemon-hostlist", "nohelp", options, &run,
222 "nohelp", options, &run, &ok); 220 &ok);
223 return ok; 221 return ok;
224} 222}
225 223