diff options
Diffstat (limited to 'src/dht/gnunet-service-dht_hello.c')
-rw-r--r-- | src/dht/gnunet-service-dht_hello.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/src/dht/gnunet-service-dht_hello.c b/src/dht/gnunet-service-dht_hello.c index 49641e649..e57951ab1 100644 --- a/src/dht/gnunet-service-dht_hello.c +++ b/src/dht/gnunet-service-dht_hello.c | |||
@@ -50,11 +50,11 @@ static struct GNUNET_CONTAINER_MultiPeerMap *peer_to_hello; | |||
50 | * @return HELLO for the given peer | 50 | * @return HELLO for the given peer |
51 | */ | 51 | */ |
52 | const struct GNUNET_HELLO_Message * | 52 | const struct GNUNET_HELLO_Message * |
53 | GDS_HELLO_get(const struct GNUNET_PeerIdentity *peer) | 53 | 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_multipeermap_get(peer_to_hello, peer); | 57 | return GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer); |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
@@ -69,30 +69,30 @@ GDS_HELLO_get(const struct GNUNET_PeerIdentity *peer) | |||
69 | * FIXME this is called once per address. Merge instead of replacing? | 69 | * FIXME this is called once per address. Merge instead of replacing? |
70 | */ | 70 | */ |
71 | static void | 71 | static void |
72 | process_hello(void *cls, | 72 | process_hello (void *cls, |
73 | const struct GNUNET_PeerIdentity *peer, | 73 | const struct GNUNET_PeerIdentity *peer, |
74 | const struct GNUNET_HELLO_Message *hello, | 74 | const struct GNUNET_HELLO_Message *hello, |
75 | const char *err_msg) | 75 | const char *err_msg) |
76 | { | 76 | { |
77 | struct GNUNET_TIME_Absolute ex; | 77 | struct GNUNET_TIME_Absolute ex; |
78 | struct GNUNET_HELLO_Message *hm; | 78 | struct GNUNET_HELLO_Message *hm; |
79 | 79 | ||
80 | if (NULL == hello) | 80 | if (NULL == hello) |
81 | return; | 81 | return; |
82 | ex = GNUNET_HELLO_get_last_expiration(hello); | 82 | ex = GNUNET_HELLO_get_last_expiration (hello); |
83 | if (0 == GNUNET_TIME_absolute_get_remaining(ex).rel_value_us) | 83 | if (0 == GNUNET_TIME_absolute_get_remaining (ex).rel_value_us) |
84 | return; | 84 | return; |
85 | GNUNET_STATISTICS_update(GDS_stats, | 85 | GNUNET_STATISTICS_update (GDS_stats, |
86 | gettext_noop("# HELLOs obtained from peerinfo"), 1, | 86 | gettext_noop ("# HELLOs obtained from peerinfo"), 1, |
87 | GNUNET_NO); | 87 | GNUNET_NO); |
88 | hm = GNUNET_CONTAINER_multipeermap_get(peer_to_hello, peer); | 88 | hm = GNUNET_CONTAINER_multipeermap_get (peer_to_hello, peer); |
89 | GNUNET_free_non_null(hm); | 89 | GNUNET_free_non_null (hm); |
90 | hm = GNUNET_malloc(GNUNET_HELLO_size(hello)); | 90 | hm = GNUNET_malloc (GNUNET_HELLO_size (hello)); |
91 | GNUNET_memcpy(hm, hello, GNUNET_HELLO_size(hello)); | 91 | GNUNET_memcpy (hm, hello, GNUNET_HELLO_size (hello)); |
92 | GNUNET_assert(GNUNET_SYSERR != | 92 | GNUNET_assert (GNUNET_SYSERR != |
93 | GNUNET_CONTAINER_multipeermap_put(peer_to_hello, | 93 | GNUNET_CONTAINER_multipeermap_put (peer_to_hello, |
94 | peer, hm, | 94 | peer, hm, |
95 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)); | 95 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)); |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
@@ -100,14 +100,14 @@ process_hello(void *cls, | |||
100 | * Initialize HELLO subsystem. | 100 | * Initialize HELLO subsystem. |
101 | */ | 101 | */ |
102 | void | 102 | void |
103 | GDS_HELLO_init() | 103 | GDS_HELLO_init () |
104 | { | 104 | { |
105 | pnc = GNUNET_PEERINFO_notify(GDS_cfg, | 105 | pnc = GNUNET_PEERINFO_notify (GDS_cfg, |
106 | GNUNET_NO, | 106 | GNUNET_NO, |
107 | &process_hello, | 107 | &process_hello, |
108 | NULL); | 108 | NULL); |
109 | peer_to_hello = GNUNET_CONTAINER_multipeermap_create(256, | 109 | peer_to_hello = GNUNET_CONTAINER_multipeermap_create (256, |
110 | GNUNET_NO); | 110 | GNUNET_NO); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
@@ -115,11 +115,11 @@ GDS_HELLO_init() | |||
115 | * Free memory occopied by the HELLO. | 115 | * Free memory occopied by the HELLO. |
116 | */ | 116 | */ |
117 | static int | 117 | static int |
118 | free_hello(void *cls, | 118 | free_hello (void *cls, |
119 | const struct GNUNET_PeerIdentity *key, | 119 | const struct GNUNET_PeerIdentity *key, |
120 | void *hello) | 120 | void *hello) |
121 | { | 121 | { |
122 | GNUNET_free(hello); | 122 | GNUNET_free (hello); |
123 | return GNUNET_OK; | 123 | return GNUNET_OK; |
124 | } | 124 | } |
125 | 125 | ||
@@ -128,20 +128,20 @@ free_hello(void *cls, | |||
128 | * Shutdown HELLO subsystem. | 128 | * Shutdown HELLO subsystem. |
129 | */ | 129 | */ |
130 | void | 130 | void |
131 | GDS_HELLO_done() | 131 | GDS_HELLO_done () |
132 | { | 132 | { |
133 | if (NULL != pnc) | 133 | if (NULL != pnc) |
134 | { | 134 | { |
135 | GNUNET_PEERINFO_notify_cancel(pnc); | 135 | GNUNET_PEERINFO_notify_cancel (pnc); |
136 | pnc = NULL; | 136 | pnc = NULL; |
137 | } | 137 | } |
138 | if (NULL != peer_to_hello) | 138 | if (NULL != peer_to_hello) |
139 | { | 139 | { |
140 | GNUNET_CONTAINER_multipeermap_iterate(peer_to_hello, | 140 | GNUNET_CONTAINER_multipeermap_iterate (peer_to_hello, |
141 | &free_hello, | 141 | &free_hello, |
142 | NULL); | 142 | NULL); |
143 | GNUNET_CONTAINER_multipeermap_destroy(peer_to_hello); | 143 | GNUNET_CONTAINER_multipeermap_destroy (peer_to_hello); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | /* end of gnunet-service-dht_hello.c */ | 147 | /* end of gnunet-service-dht_hello.c */ |