diff options
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 4f4214248..2162de866 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1422,9 +1422,9 @@ peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value) | |||
1422 | 1422 | ||
1423 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key)) | 1423 | if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key)) |
1424 | LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n"); | 1424 | LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n"); |
1425 | else | ||
1426 | GNUNET_free (peer_ctx); | ||
1425 | 1427 | ||
1426 | /* FIXME this will be called twice until the fixme in line 1451 is fixed */ | ||
1427 | GNUNET_free (peer_ctx); | ||
1428 | return GNUNET_YES; | 1428 | return GNUNET_YES; |
1429 | } | 1429 | } |
1430 | 1430 | ||
@@ -1448,7 +1448,6 @@ shutdown_task (void *cls, | |||
1448 | } | 1448 | } |
1449 | 1449 | ||
1450 | 1450 | ||
1451 | /* FIXME instead of this, destroy every known channel */ | ||
1452 | { | 1451 | { |
1453 | if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_iterate (peer_map, peer_remove_cb, NULL)) | 1452 | if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_iterate (peer_map, peer_remove_cb, NULL)) |
1454 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1453 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -1538,22 +1537,26 @@ cleanup_channel (void *cls, | |||
1538 | struct GNUNET_PeerIdentity *peer; | 1537 | struct GNUNET_PeerIdentity *peer; |
1539 | struct PeerContext *peer_ctx; | 1538 | struct PeerContext *peer_ctx; |
1540 | 1539 | ||
1541 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Channel to remote peer was destroyed.\n"); | ||
1542 | |||
1543 | peer = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info ( | 1540 | peer = (struct GNUNET_PeerIdentity *) GNUNET_CADET_channel_get_info ( |
1544 | (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER); | 1541 | (struct GNUNET_CADET_Channel *) channel, GNUNET_CADET_OPTION_PEER); |
1545 | // Guess simply casting isn't the nicest way... | 1542 | // Guess simply casting isn't the nicest way... |
1546 | // FIXME wait for cadet to change this function | 1543 | // FIXME wait for cadet to change this function |
1544 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up channel to peer %s\n", | ||
1545 | GNUNET_i2s (peer)); | ||
1546 | |||
1547 | RPS_sampler_reinitialise_by_value (peer); | 1547 | RPS_sampler_reinitialise_by_value (peer); |
1548 | 1548 | ||
1549 | peer_ctx = GNUNET_CONTAINER_multipeermap_get (peer_map, peer); | 1549 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) |
1550 | { | ||
1551 | peer_ctx = GNUNET_CONTAINER_multipeermap_get (peer_map, peer); | ||
1550 | 1552 | ||
1551 | if (NULL == peer_ctx) /* It could have been removed by shutdown_task */ | 1553 | if (NULL == peer_ctx) /* It could have been removed by shutdown_task */ |
1552 | return; | 1554 | return; |
1553 | 1555 | ||
1554 | /* Somwewhat {ab,re}use the iterator function */ | 1556 | /* Somwewhat {ab,re}use the iterator function */ |
1555 | /* Cast to void is ok, because it's used as void in peer_remove_cb */ | 1557 | /* Cast to void is ok, because it's used as void in peer_remove_cb */ |
1556 | (void) peer_remove_cb ((void *) channel, peer, peer_ctx); | 1558 | (void) peer_remove_cb ((void *) channel, peer, peer_ctx); |
1559 | } | ||
1557 | } | 1560 | } |
1558 | 1561 | ||
1559 | 1562 | ||