aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-11-04 21:01:22 +0000
committerChristian Grothoff <christian@grothoff.org>2012-11-04 21:01:22 +0000
commit0e4c7cdccfc4105f9c6e529cfa0e3722104b0ddf (patch)
treeac53b9088e75b7041e14e3455698a75da085b3d7 /src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
parentb6d09b511fbd61d3b36fde4c28624bed321bf4a1 (diff)
downloadgnunet-0e4c7cdccfc4105f9c6e529cfa0e3722104b0ddf.tar.gz
gnunet-0e4c7cdccfc4105f9c6e529cfa0e3722104b0ddf.zip
-misc bugfixes, travel hacking
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist_reconnect.c')
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index 63baced46..74ef37f16 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -28,11 +28,6 @@
28#include "gnunet_arm_service.h" 28#include "gnunet_arm_service.h"
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_service.h"
30 30
31#define VERBOSE GNUNET_NO
32
33#define START_ARM GNUNET_YES
34
35
36/** 31/**
37 * How long until we give up on transmitting the message? 32 * How long until we give up on transmitting the message?
38 */ 33 */
@@ -48,9 +43,7 @@ struct PeerContext
48 struct GNUNET_TRANSPORT_Handle *th; 43 struct GNUNET_TRANSPORT_Handle *th;
49 struct GNUNET_MessageHeader *hello; 44 struct GNUNET_MessageHeader *hello;
50 struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 45 struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
51#if START_ARM
52 struct GNUNET_OS_Process *arm_proc; 46 struct GNUNET_OS_Process *arm_proc;
53#endif
54}; 47};
55 48
56static struct PeerContext p1; 49static struct PeerContext p1;
@@ -112,9 +105,6 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer,
112{ 105{
113 if (peer == NULL) 106 if (peer == NULL)
114 return; 107 return;
115#if VERBOSE
116 FPRINTF (stderr, "Peer %s connected\n", GNUNET_i2s (peer));
117#endif
118 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n");
119 ok = 0; 109 ok = 0;
120 if (timeout_task != GNUNET_SCHEDULER_NO_TASK) 110 if (timeout_task != GNUNET_SCHEDULER_NO_TASK)
@@ -145,12 +135,10 @@ setup_peer (struct PeerContext *p, const char *cfgname)
145 135
146 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm"); 136 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
147 p->cfg = GNUNET_CONFIGURATION_create (); 137 p->cfg = GNUNET_CONFIGURATION_create ();
148#if START_ARM
149 p->arm_proc = 138 p->arm_proc =
150 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary, 139 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, binary,
151 "gnunet-service-arm", 140 "gnunet-service-arm",
152 "-c", cfgname, NULL); 141 "-c", cfgname, NULL);
153#endif
154 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 142 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
155 p->th = 143 p->th =
156 GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, &notify_connect, NULL); 144 GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, &notify_connect, NULL);
@@ -165,7 +153,6 @@ waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
165{ 153{
166 struct PeerContext *p = cls; 154 struct PeerContext *p = cls;
167 155
168#if START_ARM
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n"); 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Killing ARM process.\n");
170 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM)) 157 if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
171 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill"); 158 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
@@ -175,7 +162,6 @@ waitpid_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
175 GNUNET_OS_process_get_pid (p->arm_proc)); 162 GNUNET_OS_process_get_pid (p->arm_proc));
176 GNUNET_OS_process_destroy (p->arm_proc); 163 GNUNET_OS_process_destroy (p->arm_proc);
177 p->arm_proc = NULL; 164 p->arm_proc = NULL;
178#endif
179 GNUNET_CONFIGURATION_destroy (p->cfg); 165 GNUNET_CONFIGURATION_destroy (p->cfg);
180} 166}
181 167
@@ -218,9 +204,6 @@ check ()
218{ 204{
219 char *const argv[] = { "test-gnunet-daemon-hostlist", 205 char *const argv[] = { "test-gnunet-daemon-hostlist",
220 "-c", "test_gnunet_daemon_hostlist_data.conf", 206 "-c", "test_gnunet_daemon_hostlist_data.conf",
221#if VERBOSE
222 "-L", "DEBUG",
223#endif
224 NULL 207 NULL
225 }; 208 };
226 struct GNUNET_GETOPT_CommandLineOption options[] = { 209 struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -244,11 +227,7 @@ main (int argc, char *argv[])
244 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2"); 227 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-2");
245 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-3"); 228 GNUNET_DISK_directory_remove ("/tmp/test-gnunet-hostlist-peer-3");
246 GNUNET_log_setup ("test-gnunet-daemon-hostlist", 229 GNUNET_log_setup ("test-gnunet-daemon-hostlist",
247#if VERBOSE
248 "DEBUG",
249#else
250 "WARNING", 230 "WARNING",
251#endif
252 NULL); 231 NULL);
253 ret = check (); 232 ret = check ();
254 if (ret == 0) 233 if (ret == 0)