aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-service-dht_hello.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-04 14:00:32 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-04 14:00:32 +0000
commit83b19539f4d322b43683f5838b72e9ec2c8e6073 (patch)
treed0ab9329fcbefe360d9d14e2ace21a6b3396dfe9 /src/dht/gnunet-service-dht_hello.c
parent28a2eb43281a1f08a67954f07beb9af3a9bc9a35 (diff)
downloadgnunet-83b19539f4d322b43683f5838b72e9ec2c8e6073.tar.gz
gnunet-83b19539f4d322b43683f5838b72e9ec2c8e6073.zip
curly wars / auto-indentation
Diffstat (limited to 'src/dht/gnunet-service-dht_hello.c')
-rw-r--r--src/dht/gnunet-service-dht_hello.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c
index 5be0cbfec..578e651f8 100644
--- a/src/dht/gnunet-service-dht_hello.c
+++ b/src/dht/gnunet-service-dht_hello.c
@@ -54,8 +54,7 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
54{ 54{
55 if (NULL == peer_to_hello) 55 if (NULL == peer_to_hello)
56 return NULL; 56 return NULL;
57 return GNUNET_CONTAINER_multihashmap_get (peer_to_hello, 57 return GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey);
58 &peer->hashPubKey);
59} 58}
60 59
61 60
@@ -68,11 +67,8 @@ GDS_HELLO_get (const struct GNUNET_PeerIdentity *peer)
68 * @param error message 67 * @param error message
69 */ 68 */
70static void 69static void
71process_hello (void *cls, 70process_hello (void *cls, const struct GNUNET_PeerIdentity *peer,
72 const struct GNUNET_PeerIdentity * 71 const struct GNUNET_HELLO_Message *hello, const char *err_msg)
73 peer,
74 const struct GNUNET_HELLO_Message *
75 hello, const char *err_msg)
76{ 72{
77 struct GNUNET_TIME_Absolute ex; 73 struct GNUNET_TIME_Absolute ex;
78 struct GNUNET_HELLO_Message *hm; 74 struct GNUNET_HELLO_Message *hm;
@@ -83,18 +79,16 @@ process_hello (void *cls,
83 if (GNUNET_TIME_absolute_get_remaining (ex).rel_value == 0) 79 if (GNUNET_TIME_absolute_get_remaining (ex).rel_value == 0)
84 return; 80 return;
85 GNUNET_STATISTICS_update (GDS_stats, 81 GNUNET_STATISTICS_update (GDS_stats,
86 gettext_noop ("# HELLOs obtained from peerinfo"), 1, 82 gettext_noop ("# HELLOs obtained from peerinfo"), 1,
87 GNUNET_NO); 83 GNUNET_NO);
88 hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, 84 hm = GNUNET_CONTAINER_multihashmap_get (peer_to_hello, &peer->hashPubKey);
89 &peer->hashPubKey);
90 GNUNET_free_non_null (hm); 85 GNUNET_free_non_null (hm);
91 hm = GNUNET_malloc (GNUNET_HELLO_size (hello)); 86 hm = GNUNET_malloc (GNUNET_HELLO_size (hello));
92 memcpy (hm, hello, GNUNET_HELLO_size (hello)); 87 memcpy (hm, hello, GNUNET_HELLO_size (hello));
93 GNUNET_assert (GNUNET_SYSERR != 88 GNUNET_assert (GNUNET_SYSERR !=
94 GNUNET_CONTAINER_multihashmap_put (peer_to_hello, 89 GNUNET_CONTAINER_multihashmap_put (peer_to_hello,
95 &peer->hashPubKey, 90 &peer->hashPubKey, hm,
96 hm, 91 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
97 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE));
98} 92}
99 93
100 94
@@ -104,9 +98,7 @@ process_hello (void *cls,
104void 98void
105GDS_HELLO_init () 99GDS_HELLO_init ()
106{ 100{
107 pnc = GNUNET_PEERINFO_notify (GDS_cfg, 101 pnc = GNUNET_PEERINFO_notify (GDS_cfg, &process_hello, NULL);
108 &process_hello,
109 NULL);
110 peer_to_hello = GNUNET_CONTAINER_multihashmap_create (256); 102 peer_to_hello = GNUNET_CONTAINER_multihashmap_create (256);
111} 103}
112 104
@@ -115,9 +107,7 @@ GDS_HELLO_init ()
115 * Free memory occopied by the HELLO. 107 * Free memory occopied by the HELLO.
116 */ 108 */
117static int 109static int
118free_hello (void *cls, 110free_hello (void *cls, const GNUNET_HashCode * key, void *hello)
119 const GNUNET_HashCode *key,
120 void *hello)
121{ 111{
122 GNUNET_free (hello); 112 GNUNET_free (hello);
123 return GNUNET_OK; 113 return GNUNET_OK;
@@ -137,9 +127,7 @@ GDS_HELLO_done ()
137 } 127 }
138 if (NULL != peer_to_hello) 128 if (NULL != peer_to_hello)
139 { 129 {
140 GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello, 130 GNUNET_CONTAINER_multihashmap_iterate (peer_to_hello, &free_hello, NULL);
141 &free_hello,
142 NULL);
143 GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello); 131 GNUNET_CONTAINER_multihashmap_destroy (peer_to_hello);
144 } 132 }
145} 133}