aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cadet/gnunet-service-cadet_connection.c')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c59
1 files changed, 34 insertions, 25 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index b82c788e9..8c25a46b7 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -1354,7 +1354,12 @@ connection_cancel_queues (struct CadetConnection *c,
1354 { 1354 {
1355 GNUNET_SCHEDULER_cancel (fc->poll_task); 1355 GNUNET_SCHEDULER_cancel (fc->poll_task);
1356 fc->poll_task = NULL; 1356 fc->poll_task = NULL;
1357 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cancel POLL in ccq for fc %p\n", fc); 1357 LOG (GNUNET_ERROR_TYPE_DEBUG, " cancelled POLL task for fc %p\n", fc);
1358 }
1359 if (NULL != fc->poll_msg)
1360 {
1361 GCC_cancel (fc->poll_msg);
1362 LOG (GNUNET_ERROR_TYPE_DEBUG, " cancelled POLL msg for fc %p\n", fc);
1358 } 1363 }
1359 peer = get_hop (c, fwd); 1364 peer = get_hop (c, fwd);
1360 GCP_queue_cancel (peer, c); 1365 GCP_queue_cancel (peer, c);
@@ -1852,6 +1857,30 @@ unregister_neighbors (struct CadetConnection *c)
1852 1857
1853 1858
1854/** 1859/**
1860 * Invalidates all paths towards all peers that comprise the connection which
1861 * rely on the disconnected peer.
1862 *
1863 * ~O(n^3) (peers in connection * paths/peer * links/path)
1864 *
1865 * @param c Connection whose peers' paths to clean.
1866 * @param disconnected Peer that disconnected.
1867 */
1868static void
1869invalidate_paths (struct CadetConnection *c, struct CadetPeer *disconnected)
1870{
1871 struct CadetPeer *peer;
1872 unsigned int i;
1873
1874 for (i = 0; i < c->path->length; i++)
1875 {
1876 peer = GCP_get_short (c->path->peers[i], GNUNET_NO);
1877 if (NULL != peer)
1878 GCP_notify_broken_link (peer, &my_full_id, GCP_get_id (disconnected));
1879 }
1880}
1881
1882
1883/**
1855 * Bind the connection to the peer and the tunnel to that peer. 1884 * Bind the connection to the peer and the tunnel to that peer.
1856 * 1885 *
1857 * If the peer has no tunnel, create one. Update tunnel and connection 1886 * If the peer has no tunnel, create one. Update tunnel and connection
@@ -3045,20 +3074,6 @@ GCC_destroy (struct CadetConnection *c)
3045 path_destroy (c->path); 3074 path_destroy (c->path);
3046 c->path = NULL; 3075 c->path = NULL;
3047 3076
3048 /* Cancel maintainance task (keepalive/timeout) */
3049 if (NULL != c->fwd_fc.poll_msg)
3050 {
3051 GCC_cancel (c->fwd_fc.poll_msg);
3052 LOG (GNUNET_ERROR_TYPE_DEBUG,
3053 " POLL msg FWD canceled\n");
3054 }
3055 if (NULL != c->bck_fc.poll_msg)
3056 {
3057 GCC_cancel (c->bck_fc.poll_msg);
3058 LOG (GNUNET_ERROR_TYPE_DEBUG,
3059 " POLL msg BCK canceled\n");
3060 }
3061
3062 /* Delete from tunnel */ 3077 /* Delete from tunnel */
3063 if (NULL != c->t) 3078 if (NULL != c->t)
3064 GCT_remove_connection (c->t, c); 3079 GCT_remove_connection (c->t, c);
@@ -3069,16 +3084,7 @@ GCC_destroy (struct CadetConnection *c)
3069 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task); 3084 GNUNET_SCHEDULER_cancel (c->fwd_maintenance_task);
3070 if (NULL != c->bck_maintenance_task) 3085 if (NULL != c->bck_maintenance_task)
3071 GNUNET_SCHEDULER_cancel (c->bck_maintenance_task); 3086 GNUNET_SCHEDULER_cancel (c->bck_maintenance_task);
3072 if (NULL != c->fwd_fc.poll_task) 3087
3073 {
3074 GNUNET_SCHEDULER_cancel (c->fwd_fc.poll_task);
3075 LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL task FWD canceled\n");
3076 }
3077 if (NULL != c->bck_fc.poll_task)
3078 {
3079 GNUNET_SCHEDULER_cancel (c->bck_fc.poll_task);
3080 LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL task BCK canceled\n");
3081 }
3082 if (GNUNET_NO == c->was_removed) 3088 if (GNUNET_NO == c->was_removed)
3083 { 3089 {
3084 GNUNET_break (GNUNET_YES == 3090 GNUNET_break (GNUNET_YES ==
@@ -3289,6 +3295,9 @@ GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer)
3289 LOG (GNUNET_ERROR_TYPE_DEBUG, 3295 LOG (GNUNET_ERROR_TYPE_DEBUG,
3290 "shutting down %s, %s disconnected\n", 3296 "shutting down %s, %s disconnected\n",
3291 GCC_2s (c), peer_name); 3297 GCC_2s (c), peer_name);
3298
3299 invalidate_paths (c, peer);
3300
3292 hop = get_prev_hop (c); 3301 hop = get_prev_hop (c);
3293 if (NULL == hop) 3302 if (NULL == hop)
3294 { 3303 {