aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_custommap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-service-rps_custommap.c')
-rw-r--r--src/rps/gnunet-service-rps_custommap.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c
index aef081a00..3513ff8da 100644
--- a/src/rps/gnunet-service-rps_custommap.c
+++ b/src/rps/gnunet-service-rps_custommap.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 3 Copyright (C)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -204,6 +202,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
204 p = GNUNET_CONTAINER_multihashmap32_get (c_peer_map->hash_map, *index); 202 p = GNUNET_CONTAINER_multihashmap32_get (c_peer_map->hash_map, *index);
205 GNUNET_assert (NULL != p); 203 GNUNET_assert (NULL != p);
206 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *index); 204 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *index);
205 // TODO wrong peerid?
207 GNUNET_CONTAINER_multipeermap_remove_all (c_peer_map->peer_map, peer); 206 GNUNET_CONTAINER_multipeermap_remove_all (c_peer_map->peer_map, peer);
208 if (*index != CustomPeerMap_size (c_peer_map)) 207 if (*index != CustomPeerMap_size (c_peer_map))
209 { /* fill 'gap' with peer at last index */ 208 { /* fill 'gap' with peer at last index */
@@ -215,13 +214,14 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
215 GNUNET_assert (NULL != last_index); 214 GNUNET_assert (NULL != last_index);
216 GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index); 215 GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index);
217 GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, last_p, 216 GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, last_p,
218 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 217 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
219 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *last_index); 218 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *last_index);
220 *last_index = *index; 219 *last_index = *index;
221 } 220 }
222 GNUNET_free (index); 221 GNUNET_free (index);
223 GNUNET_assert (GNUNET_CONTAINER_multihashmap32_size (c_peer_map->hash_map) == 222 GNUNET_assert (GNUNET_CONTAINER_multihashmap32_size (c_peer_map->hash_map) ==
224 GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map)); 223 GNUNET_CONTAINER_multipeermap_size (c_peer_map->peer_map));
224 GNUNET_free (p);
225 return GNUNET_OK; 225 return GNUNET_OK;
226} 226}
227 227