aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-12-09 18:56:41 +0000
committerBart Polot <bart@net.in.tum.de>2015-12-09 18:56:41 +0000
commitb3d15f0414b5e64ed04cc914b3bf21723d5f0a94 (patch)
tree37db9bdcff3250f650ef3ee9c498068268d42ea1 /src/cadet
parentc6a9356722f44b706abcd68934ea2dc1238874ce (diff)
downloadgnunet-b3d15f0414b5e64ed04cc914b3bf21723d5f0a94.tar.gz
gnunet-b3d15f0414b5e64ed04cc914b3bf21723d5f0a94.zip
Another attampt at fixing #4010: mark unavailable neighbors in FlowControl struct, test on POLL
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index c61f4a53e..c40821c30 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -71,6 +71,7 @@ struct CadetFlowControl
71 71
72 /** 72 /**
73 * How many messages do we accept in the queue. 73 * How many messages do we accept in the queue.
74 * If 0, the connection is broken in this direction (next hop disconnected).
74 */ 75 */
75 unsigned int queue_max; 76 unsigned int queue_max;
76 77
@@ -1412,6 +1413,11 @@ poll_sent (void *cls,
1412 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n"); 1413 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n");
1413 return; 1414 return;
1414 } 1415 }
1416 if (0 == fc->queue_max)
1417 {
1418 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL cancelled: neighbor disconnected\n");
1419 return;
1420 }
1415 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n", 1421 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n",
1416 GCC_2s (c)); 1422 GCC_2s (c));
1417 GNUNET_assert (NULL == fc->poll_task); 1423 GNUNET_assert (NULL == fc->poll_task);
@@ -3318,6 +3324,7 @@ GCC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
3318void 3324void
3319GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer) 3325GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer)
3320{ 3326{
3327 struct CadetFlowControl *fc;
3321 struct CadetPeer *hop; 3328 struct CadetPeer *hop;
3322 char peer_name[16]; 3329 char peer_name[16];
3323 int fwd; 3330 int fwd;
@@ -3348,7 +3355,12 @@ GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer)
3348 GCC_check_connections (); 3355 GCC_check_connections ();
3349 return; 3356 return;
3350 } 3357 }
3358 /* Mark FlowControl towards the peer as unavaliable. */
3359 fc = fwd ? &c->bck_fc : &c->fwd_fc;
3360 fc->queue_max = 0;
3361
3351 send_broken (c, &my_full_id, GCP_get_id (peer), fwd); 3362 send_broken (c, &my_full_id, GCP_get_id (peer), fwd);
3363
3352 /* Connection will have at least one pending message 3364 /* Connection will have at least one pending message
3353 * (the one we just scheduled), so delay destruction 3365 * (the one we just scheduled), so delay destruction
3354 * and remove from map so we don't use accidentally. */ 3366 * and remove from map so we don't use accidentally. */
@@ -3735,6 +3747,13 @@ GCC_start_poll (struct CadetConnection *c, int fwd)
3735 fc->poll_task, fc->poll_msg); 3747 fc->poll_task, fc->poll_msg);
3736 return; 3748 return;
3737 } 3749 }
3750 if (0 == fc->queue_max)
3751 {
3752 /* Should not be needed, traffic should've been cancelled. */
3753 GNUNET_break (0);
3754 LOG (GNUNET_ERROR_TYPE_DEBUG, " POLL not possible, peer disconnected\n");
3755 return;
3756 }
3738 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL started on request\n"); 3757 LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL started on request\n");
3739 fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time, 3758 fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
3740 &connection_poll, 3759 &connection_poll,