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