aboutsummaryrefslogtreecommitdiff
path: root/src/util/peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/peer.c')
-rw-r--r--src/util/peer.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/util/peer.c b/src/util/peer.c
index e013c22e9..96ac271c0 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -73,6 +73,35 @@ static unsigned int free_list_start;
73 73
74 74
75/** 75/**
76 * Search for a peer identity. The reference counter is not changed.
77 *
78 * @param pid identity to find
79 * @return the interned identity or 0.
80 */
81GNUNET_PEER_Id
82GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid)
83{
84 struct PeerEntry *e;
85 long off;
86
87 if (pid == NULL)
88 return 0;
89 if (NULL == map)
90 return 0;
91 off = (long) GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
92 e = (off == 0) ? NULL : &table[off];
93 if (e != NULL)
94 {
95 GNUNET_assert (e->rc > 0);
96 return e->pid;
97 }
98 else
99 {
100 return 0;
101 }
102}
103
104/**
76 * Intern an peer identity. If the identity is already known, its 105 * Intern an peer identity. If the identity is already known, its
77 * reference counter will be increased by one. 106 * reference counter will be increased by one.
78 * 107 *