[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34934 - gnunet/src/rps
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34934 - gnunet/src/rps |
Date: |
Sun, 18 Jan 2015 16:55:20 +0100 |
Author: ch3
Date: 2015-01-18 16:55:20 +0100 (Sun, 18 Jan 2015)
New Revision: 34934
Modified:
gnunet/src/rps/gnunet-service-rps.c
Log:
simplified removal of peers from peermap
Modified: gnunet/src/rps/gnunet-service-rps.c
===================================================================
--- gnunet/src/rps/gnunet-service-rps.c 2015-01-18 14:10:50 UTC (rev 34933)
+++ gnunet/src/rps/gnunet-service-rps.c 2015-01-18 15:55:20 UTC (rev 34934)
@@ -1056,22 +1056,8 @@
int
peer_remove_cb (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
{
- struct GNUNET_PeerIdentity *tmp_id;
struct PeerContext *peer_ctx;
- /* Check if we are starting to again iterate over same peers */
- if (NULL == cls)
- { /* Store first id we see */
- tmp_id = GNUNET_new (struct GNUNET_PeerIdentity);
- *tmp_id = *key;
- cls = tmp_id;
- }
- else if (0 == GNUNET_CRYPTO_cmp_peer_identity (key, cls))
- { /* Check if we see the first id again */
- GNUNET_free (cls);
- return GNUNET_NO;
- }
-
peer_ctx = (struct PeerContext *) value;
if ( NULL != peer_ctx->mq)
@@ -1083,7 +1069,8 @@
if ( NULL != peer_ctx->from_channel)
GNUNET_CADET_channel_destroy (peer_ctx->from_channel);
- // call _peermap_remove_all()?
+ if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_remove_all (peer_map, key))
+ LOG (GNUNET_ERROR_TYPE_WARNING, "removing peer from peer_map failed\n");
return GNUNET_YES;
}
@@ -1101,16 +1088,14 @@
{
LOG (GNUNET_ERROR_TYPE_DEBUG, "RPS is going down\n");
- uint32_t num_peers;
-
if ( NULL != do_round_task )
{
GNUNET_SCHEDULER_cancel (do_round_task);
do_round_task = NULL;
}
- num_peers = GNUNET_CONTAINER_multipeermap_iterate (peer_map, peer_remove_cb,
NULL);
- if (GNUNET_SYSERR == num_peers)
+
+ if (GNUNET_SYSERR == GNUNET_CONTAINER_multipeermap_iterate (peer_map,
peer_remove_cb, NULL))
LOG (GNUNET_ERROR_TYPE_WARNING,
"Iterating over peers to disconnect from them was cancelled\n");
@@ -1205,7 +1190,6 @@
peer_ctx = GNUNET_CONTAINER_multipeermap_get (peer_map, peer);
/* Somwewhat {ab,re}use the iterator function */
(void) peer_remove_cb (peer, peer, peer_ctx);
- GNUNET_CONTAINER_multipeermap_remove_all (peer_map, peer);
}
/**
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34934 - gnunet/src/rps,
gnunet <=