aboutsummaryrefslogtreecommitdiff
path: root/src/topology
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-01-14 12:08:39 +0000
committerChristian Grothoff <christian@grothoff.org>2010-01-14 12:08:39 +0000
commit9e2d093fbc96354affbc51f9d21b5f5593b348a1 (patch)
treeb15478d66a588ffc66d9880697a6d6a2796a1b50 /src/topology
parentbb4e48f94a3daba7b0294ce8760a231b0601fa11 (diff)
downloadgnunet-9e2d093fbc96354affbc51f9d21b5f5593b348a1.tar.gz
gnunet-9e2d093fbc96354affbc51f9d21b5f5593b348a1.zip
fix hang, use notifications
Diffstat (limited to 'src/topology')
-rw-r--r--src/topology/gnunet-daemon-topology.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index d9f5e0ef2..f63cc0d85 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2007, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -139,6 +139,14 @@ struct HelloList
139 139
140 140
141/** 141/**
142 * Our peerinfo notification context. We use notification
143 * to instantly learn about new peers as they are discovered
144 * as well as periodic iteration to try peers again after
145 * a while.
146 */
147static struct GNUNET_PEERINFO_NotifyContext *peerinfo_notify;
148
149/**
142 * Linked list of HELLOs for advertising. 150 * Linked list of HELLOs for advertising.
143 */ 151 */
144static struct HelloList *hellos; 152static struct HelloList *hellos;
@@ -270,6 +278,7 @@ attempt_connect (const struct GNUNET_PeerIdentity *peer,
270 { 278 {
271 if (0 == memcmp (&pos->id, peer, sizeof (struct GNUNET_PeerIdentity))) 279 if (0 == memcmp (&pos->id, peer, sizeof (struct GNUNET_PeerIdentity)))
272 break; 280 break;
281 pos = pos->next;
273 } 282 }
274 } 283 }
275 if (pos == NULL) 284 if (pos == NULL)
@@ -1151,6 +1160,11 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1151{ 1160{
1152 struct PeerList *pl; 1161 struct PeerList *pl;
1153 1162
1163 if (NULL != peerinfo_notify)
1164 {
1165 GNUNET_PEERINFO_notify_cancel (peerinfo_notify);
1166 peerinfo_notify = NULL;
1167 }
1154 GNUNET_TRANSPORT_disconnect (transport); 1168 GNUNET_TRANSPORT_disconnect (transport);
1155 transport = NULL; 1169 transport = NULL;
1156 if (handle != NULL) 1170 if (handle != NULL)
@@ -1162,7 +1176,7 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1162 { 1176 {
1163 friends = pl->next; 1177 friends = pl->next;
1164 GNUNET_free (pl); 1178 GNUNET_free (pl);
1165 } 1179 }
1166} 1180}
1167 1181
1168 1182
@@ -1258,6 +1272,9 @@ run (void *cls,
1258 GNUNET_SCHEDULER_shutdown (sched); 1272 GNUNET_SCHEDULER_shutdown (sched);
1259 return; 1273 return;
1260 } 1274 }
1275 peerinfo_notify = GNUNET_PEERINFO_notify (cfg, sched,
1276 &process_peer,
1277 NULL);
1261} 1278}
1262 1279
1263 1280