aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-06-14 11:42:07 +0000
committerChristian Grothoff <christian@grothoff.org>2011-06-14 11:42:07 +0000
commitc61072f43108dfc14b109278cdebbb4256a969e9 (patch)
tree6e1ec9b1062def8e687d7b83d155c58a2dfc9f12 /src/util
parent214214c9dac19beeee47825fc5e5a2e752e47978 (diff)
downloadgnunet-c61072f43108dfc14b109278cdebbb4256a969e9.tar.gz
gnunet-c61072f43108dfc14b109278cdebbb4256a969e9.zip
fixing 1692
Diffstat (limited to 'src/util')
-rw-r--r--src/util/peer.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/util/peer.c b/src/util/peer.c
index f30c720aa..e013c22e9 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -85,12 +85,14 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
85 GNUNET_PEER_Id ret; 85 GNUNET_PEER_Id ret;
86 struct PeerEntry *e; 86 struct PeerEntry *e;
87 unsigned int i; 87 unsigned int i;
88 long off;
88 89
89 if (pid == NULL) 90 if (pid == NULL)
90 return 0; 91 return 0;
91 if (NULL == map) 92 if (NULL == map)
92 map = GNUNET_CONTAINER_multihashmap_create (32); 93 map = GNUNET_CONTAINER_multihashmap_create (32);
93 e = GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey); 94 off = (long) GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
95 e = (off == 0) ? NULL : &table[off];
94 if (e != NULL) 96 if (e != NULL)
95 { 97 {
96 GNUNET_assert (e->rc > 0); 98 GNUNET_assert (e->rc > 0);
@@ -119,7 +121,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
119 GNUNET_break (GNUNET_OK == 121 GNUNET_break (GNUNET_OK ==
120 GNUNET_CONTAINER_multihashmap_put (map, 122 GNUNET_CONTAINER_multihashmap_put (map,
121 &pid->hashPubKey, 123 &pid->hashPubKey,
122 &table[ret], 124 (void *) (long) ret,
123 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 125 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
124 return ret; 126 return ret;
125} 127}
@@ -152,7 +154,7 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count)
152 GNUNET_break (GNUNET_OK == 154 GNUNET_break (GNUNET_OK ==
153 GNUNET_CONTAINER_multihashmap_remove (map, 155 GNUNET_CONTAINER_multihashmap_remove (map,
154 &table[id].id.hashPubKey, 156 &table[id].id.hashPubKey,
155 &table[id])); 157 (void*) (long) id));
156 table[id].pid = free_list_start; 158 table[id].pid = free_list_start;
157 free_list_start = id; 159 free_list_start = id;
158 } 160 }
@@ -180,7 +182,7 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
180 GNUNET_break (GNUNET_OK == 182 GNUNET_break (GNUNET_OK ==
181 GNUNET_CONTAINER_multihashmap_remove (map, 183 GNUNET_CONTAINER_multihashmap_remove (map,
182 &table[id].id.hashPubKey, 184 &table[id].id.hashPubKey,
183 &table[id])); 185 (void*) (long) id));
184 table[id].pid = free_list_start; 186 table[id].pid = free_list_start;
185 free_list_start = id; 187 free_list_start = id;
186 } 188 }