aboutsummaryrefslogtreecommitdiff
path: root/src/cadet
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-09-03 18:04:10 +0000
committerBart Polot <bart@net.in.tum.de>2015-09-03 18:04:10 +0000
commit7f4591909fcadddac2679d7e1568d80f67c18d4b (patch)
tree7800759512db5536dd3d0671a85a2bc31e99bbb6 /src/cadet
parent31b1ed4f795ee7300958410886c77f4d3459550f (diff)
downloadgnunet-7f4591909fcadddac2679d7e1568d80f67c18d4b.tar.gz
gnunet-7f4591909fcadddac2679d7e1568d80f67c18d4b.zip
Fix #3929: cancel poll towards disconnected neighbor
Diffstat (limited to 'src/cadet')
-rw-r--r--src/cadet/gnunet-service-cadet_connection.c14
-rw-r--r--src/cadet/gnunet-service-cadet_connection.h3
-rw-r--r--src/cadet/gnunet-service-cadet_peer.c5
3 files changed, 11 insertions, 11 deletions
diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c
index 04cb2294a..f27637c7d 100644
--- a/src/cadet/gnunet-service-cadet_connection.c
+++ b/src/cadet/gnunet-service-cadet_connection.c
@@ -3270,17 +3270,18 @@ GCC_allow (struct CadetConnection *c, unsigned int buffer, int fwd)
3270 * @param peer Peer that disconnected. 3270 * @param peer Peer that disconnected.
3271 */ 3271 */
3272void 3272void
3273GCC_notify_broken (struct CadetConnection *c, 3273GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer)
3274 struct CadetPeer *peer)
3275{ 3274{
3276 struct CadetPeer *hop; 3275 struct CadetPeer *hop;
3276 char peer_name[16];
3277 int fwd; 3277 int fwd;
3278 3278
3279 GCC_check_connections (); 3279 GCC_check_connections ();
3280 strncpy (peer_name, GCP_2s (peer), 16);
3281 peer_name[15] = '\0';
3280 LOG (GNUNET_ERROR_TYPE_DEBUG, 3282 LOG (GNUNET_ERROR_TYPE_DEBUG,
3281 "Notify broken on %s due to %s disconnect\n", 3283 "shutting down %s, %s disconnected\n",
3282 GCC_2s (c), 3284 GCC_2s (c), peer_name);
3283 GCP_2s (peer));
3284 hop = get_prev_hop (c); 3285 hop = get_prev_hop (c);
3285 if (NULL == hop) 3286 if (NULL == hop)
3286 { 3287 {
@@ -3290,7 +3291,7 @@ GCC_notify_broken (struct CadetConnection *c,
3290 } 3291 }
3291 fwd = (peer == hop); 3292 fwd = (peer == hop);
3292 if ( (GNUNET_YES == GCC_is_terminal (c, fwd)) || 3293 if ( (GNUNET_YES == GCC_is_terminal (c, fwd)) ||
3293 (GNUNET_YES == c->destroy) ) 3294 (GNUNET_NO != c->destroy) )
3294 { 3295 {
3295 /* Local shutdown, or other peer already down (hence 'c->destroy'); 3296 /* Local shutdown, or other peer already down (hence 'c->destroy');
3296 so there is no one to notify about this, just clean up. */ 3297 so there is no one to notify about this, just clean up. */
@@ -3312,6 +3313,7 @@ GCC_notify_broken (struct CadetConnection *c,
3312 c)); 3313 c));
3313 /* Cancel queue in the direction that just died. */ 3314 /* Cancel queue in the direction that just died. */
3314 connection_cancel_queues (c, ! fwd); 3315 connection_cancel_queues (c, ! fwd);
3316 GCC_stop_poll (c, ! fwd);
3315 unregister_neighbors (c); 3317 unregister_neighbors (c);
3316 GCC_check_connections (); 3318 GCC_check_connections ();
3317} 3319}
diff --git a/src/cadet/gnunet-service-cadet_connection.h b/src/cadet/gnunet-service-cadet_connection.h
index 784d9cf59..645e277b1 100644
--- a/src/cadet/gnunet-service-cadet_connection.h
+++ b/src/cadet/gnunet-service-cadet_connection.h
@@ -460,8 +460,7 @@ GCC_bck_keepalive (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
460 * @param peer Peer that disconnected. 460 * @param peer Peer that disconnected.
461 */ 461 */
462void 462void
463GCC_notify_broken (struct CadetConnection *c, 463GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer);
464 struct CadetPeer *peer);
465 464
466/** 465/**
467 * Is this peer the first one on the connection? 466 * Is this peer the first one on the connection?
diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c
index 9b7c19e4a..64adb6268 100644
--- a/src/cadet/gnunet-service-cadet_peer.c
+++ b/src/cadet/gnunet-service-cadet_peer.c
@@ -343,7 +343,7 @@ GCP_debug (const struct CadetPeer *p, enum GNUNET_ErrorType level)
343 * Iterator to notify all connections of a broken link. Mark connections 343 * Iterator to notify all connections of a broken link. Mark connections
344 * to destroy after all traffic has been sent. 344 * to destroy after all traffic has been sent.
345 * 345 *
346 * @param cls Closure (peer disconnected). 346 * @param cls Closure (disconnected peer).
347 * @param key Current key code (peer id). 347 * @param key Current key code (peer id).
348 * @param value Value in the hash map (connection). 348 * @param value Value in the hash map (connection).
349 * 349 *
@@ -361,8 +361,7 @@ notify_broken (void *cls,
361 "Notifying %s due to %s\n", 361 "Notifying %s due to %s\n",
362 GCC_2s (c), 362 GCC_2s (c),
363 GCP_2s (peer)); 363 GCP_2s (peer));
364 GCC_notify_broken (c, 364 GCC_neighbor_disconnected (c, peer);
365 peer);
366 return GNUNET_YES; 365 return GNUNET_YES;
367} 366}
368 367