aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-11-08 11:40:26 +0000
committerChristian Grothoff <christian@grothoff.org>2015-11-08 11:40:26 +0000
commit94a7d55c9473299c471bce218e68b90847d961b8 (patch)
treecc6019b7003d6ee117fa13495ef74f5f9008bf46 /src/transport/gnunet-service-transport_neighbours.c
parent3fd8c038f6b42cd13f20fa82ce2f130d258366c0 (diff)
downloadgnunet-94a7d55c9473299c471bce218e68b90847d961b8.tar.gz
gnunet-94a7d55c9473299c471bce218e68b90847d961b8.zip
-more DCE after try_connect refactoring
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c77
1 files changed, 0 insertions, 77 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 4d3e8c0bc..6b4300488 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -462,52 +462,11 @@ struct NeighbourMapEntry
462 462
463 463
464/** 464/**
465 * Context for blacklist checks and the #try_connect_bl_check_cont()
466 * function. Stores information about ongoing blacklist checks.
467 */
468struct BlackListCheckContext
469{
470
471 /**
472 * We keep blacklist checks in a DLL.
473 */
474 struct BlackListCheckContext *next;
475
476 /**
477 * We keep blacklist checks in a DLL.
478 */
479 struct BlackListCheckContext *prev;
480
481 /**
482 * Address that is being checked.
483 */
484 struct NeighbourAddress na;
485
486 /**
487 * Handle to the ongoing blacklist check.
488 */
489 struct GST_BlacklistCheck *bc;
490};
491
492
493/**
494 * Hash map from peer identities to the respective `struct NeighbourMapEntry`. 465 * Hash map from peer identities to the respective `struct NeighbourMapEntry`.
495 */ 466 */
496static struct GNUNET_CONTAINER_MultiPeerMap *neighbours; 467static struct GNUNET_CONTAINER_MultiPeerMap *neighbours;
497 468
498/** 469/**
499 * We keep blacklist checks in a DLL so that we can find
500 * the 'sessions' in their 'struct NeighbourAddress' if
501 * a session goes down.
502 */
503static struct BlackListCheckContext *bc_head;
504
505/**
506 * We keep blacklist checks in a DLL.
507 */
508static struct BlackListCheckContext *bc_tail;
509
510/**
511 * List of pending blacklist checks: head 470 * List of pending blacklist checks: head
512 */ 471 */
513static struct BlacklistCheckSwitchContext *pending_bc_head; 472static struct BlacklistCheckSwitchContext *pending_bc_head;
@@ -3256,25 +3215,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3256 struct GNUNET_ATS_Session *session) 3215 struct GNUNET_ATS_Session *session)
3257{ 3216{
3258 struct NeighbourMapEntry *n; 3217 struct NeighbourMapEntry *n;
3259 struct BlackListCheckContext *bcc;
3260 struct BlackListCheckContext *bcc_next;
3261 3218
3262 /* make sure to cancel all ongoing blacklist checks involving 'session' */
3263 bcc_next = bc_head;
3264 while (NULL != (bcc = bcc_next))
3265 {
3266 bcc_next = bcc->next;
3267 if (bcc->na.session == session)
3268 {
3269 if (NULL != bcc->bc)
3270 GST_blacklist_test_cancel (bcc->bc);
3271 GNUNET_HELLO_address_free (bcc->na.address);
3272 GNUNET_CONTAINER_DLL_remove (bc_head,
3273 bc_tail,
3274 bcc);
3275 GNUNET_free (bcc);
3276 }
3277 }
3278 if (NULL == (n = lookup_neighbour (peer))) 3219 if (NULL == (n = lookup_neighbour (peer)))
3279 return GNUNET_NO; /* can't affect us */ 3220 return GNUNET_NO; /* can't affect us */
3280 if (session != n->primary_address.session) 3221 if (session != n->primary_address.session)
@@ -3817,9 +3758,6 @@ disconnect_all_neighbours (void *cls,
3817void 3758void
3818GST_neighbours_stop () 3759GST_neighbours_stop ()
3819{ 3760{
3820 struct BlacklistCheckSwitchContext *cur;
3821 struct BlacklistCheckSwitchContext *next;
3822
3823 if (NULL == neighbours) 3761 if (NULL == neighbours)
3824 return; 3762 return;
3825 if (NULL != util_transmission_tk) 3763 if (NULL != util_transmission_tk)
@@ -3832,21 +3770,6 @@ GST_neighbours_stop ()
3832 NULL); 3770 NULL);
3833 GNUNET_CONTAINER_multipeermap_destroy (neighbours); 3771 GNUNET_CONTAINER_multipeermap_destroy (neighbours);
3834 neighbours = NULL; 3772 neighbours = NULL;
3835 next = pending_bc_head;
3836 for (cur = next; NULL != cur; cur = next)
3837 {
3838 next = cur->next;
3839 GNUNET_CONTAINER_DLL_remove (pending_bc_head,
3840 pending_bc_tail,
3841 cur);
3842
3843 if (NULL != cur->blc)
3844 {
3845 GST_blacklist_test_cancel (cur->blc);
3846 cur->blc = NULL;
3847 }
3848 GNUNET_free (cur);
3849 }
3850} 3773}
3851 3774
3852 3775