aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
commit95f9076a2139f5fb042b944a0658b6cda2fa35db (patch)
treeb0826a2a1dcf812e6b4450fe6b05d47cd53ae49d /src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
parent7746f68db77b9ca3c4aaca24ab2ce5253461240b (diff)
downloadgnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.tar.gz
gnunet-95f9076a2139f5fb042b944a0658b6cda2fa35db.zip
implementing new scheduler shutdown semantics
Diffstat (limited to 'src/hostlist/test_gnunet_daemon_hostlist_reconnect.c')
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index 0af16e065..562eec55b 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
@@ -100,11 +100,13 @@ timeout_error (void *cls)
100 * @param distance in overlay hops, as given by transport plugin 100 * @param distance in overlay hops, as given by transport plugin
101 */ 101 */
102static void 102static void
103notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) 103notify_connect (void *cls,
104 const struct GNUNET_PeerIdentity *peer)
104{ 105{
105 if (peer == NULL) 106 if (peer == NULL)
106 return; 107 return;
107 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers connected, shutting down.\n"); 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Peers connected, shutting down.\n");
108 ok = 0; 110 ok = 0;
109 if (timeout_task != NULL) 111 if (timeout_task != NULL)
110 { 112 {
@@ -116,7 +118,8 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer)
116 118
117 119
118static void 120static void
119process_hello (void *cls, const struct GNUNET_MessageHeader *message) 121process_hello (void *cls,
122 const struct GNUNET_MessageHeader *message)
120{ 123{
121 struct PeerContext *p = cls; 124 struct PeerContext *p = cls;
122 125
@@ -171,7 +174,8 @@ static void
171stop_arm (struct PeerContext *p) 174stop_arm (struct PeerContext *p)
172{ 175{
173 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ARM to stop core service\n"); 176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asking ARM to stop core service\n");
174 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &waitpid_task, p); 177 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
178 &waitpid_task, p);
175} 179}
176 180
177 181
@@ -192,8 +196,10 @@ run (void *cls, char *const *args, const char *cfgfile,
192{ 196{
193 GNUNET_assert (ok == 1); 197 GNUNET_assert (ok == 1);
194 ok++; 198 ok++;
195 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_error, NULL); 199 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
196 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 200 &timeout_error, NULL);
201 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
202 &shutdown_task,
197 NULL); 203 NULL);
198 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf"); 204 setup_peer (&p1, "test_gnunet_daemon_hostlist_peer1.conf");
199 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf"); 205 setup_peer (&p2, "test_gnunet_daemon_hostlist_peer2.conf");