diff options
Diffstat (limited to 'src/transport/transport_api_monitor_plugins.c')
-rw-r--r-- | src/transport/transport_api_monitor_plugins.c | 294 |
1 files changed, 143 insertions, 151 deletions
diff --git a/src/transport/transport_api_monitor_plugins.c b/src/transport/transport_api_monitor_plugins.c index f0acc2408..12d052008 100644 --- a/src/transport/transport_api_monitor_plugins.c +++ b/src/transport/transport_api_monitor_plugins.c | |||
@@ -11,12 +11,12 @@ | |||
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 | Affero 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 Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file transport/transport_api_monitor_plugins.c | 22 | * @file transport/transport_api_monitor_plugins.c |
@@ -35,9 +35,7 @@ | |||
35 | /** | 35 | /** |
36 | * Handle for a plugin session state monitor. | 36 | * Handle for a plugin session state monitor. |
37 | */ | 37 | */ |
38 | struct GNUNET_TRANSPORT_PluginMonitor | 38 | struct GNUNET_TRANSPORT_PluginMonitor { |
39 | { | ||
40 | |||
41 | /** | 39 | /** |
42 | * Connection to the service. | 40 | * Connection to the service. |
43 | */ | 41 | */ |
@@ -73,7 +71,6 @@ struct GNUNET_TRANSPORT_PluginMonitor | |||
73 | * Task ID for reconnect. | 71 | * Task ID for reconnect. |
74 | */ | 72 | */ |
75 | struct GNUNET_SCHEDULER_Task *reconnect_task; | 73 | struct GNUNET_SCHEDULER_Task *reconnect_task; |
76 | |||
77 | }; | 74 | }; |
78 | 75 | ||
79 | 76 | ||
@@ -81,8 +78,7 @@ struct GNUNET_TRANSPORT_PluginMonitor | |||
81 | * Abstract representation of a plugin's session. | 78 | * Abstract representation of a plugin's session. |
82 | * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service. | 79 | * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service. |
83 | */ | 80 | */ |
84 | struct GNUNET_TRANSPORT_PluginSession | 81 | struct GNUNET_TRANSPORT_PluginSession { |
85 | { | ||
86 | /** | 82 | /** |
87 | * Unique session identifier. | 83 | * Unique session identifier. |
88 | */ | 84 | */ |
@@ -102,7 +98,7 @@ struct GNUNET_TRANSPORT_PluginSession | |||
102 | * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *` | 98 | * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *` |
103 | */ | 99 | */ |
104 | static void | 100 | static void |
105 | do_plugin_connect (void *cls); | 101 | do_plugin_connect(void *cls); |
106 | 102 | ||
107 | 103 | ||
108 | /** | 104 | /** |
@@ -114,23 +110,23 @@ do_plugin_connect (void *cls); | |||
114 | * @return #GNUNET_OK (continue to iterate) | 110 | * @return #GNUNET_OK (continue to iterate) |
115 | */ | 111 | */ |
116 | static int | 112 | static int |
117 | free_entry (void *cls, | 113 | free_entry(void *cls, |
118 | uint32_t key, | 114 | uint32_t key, |
119 | void *value) | 115 | void *value) |
120 | { | 116 | { |
121 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; | 117 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; |
122 | struct GNUNET_TRANSPORT_PluginSession *ps = value; | 118 | struct GNUNET_TRANSPORT_PluginSession *ps = value; |
123 | 119 | ||
124 | pm->cb (pm->cb_cls, | 120 | pm->cb(pm->cb_cls, |
125 | ps, | 121 | ps, |
126 | &ps->client_ctx, | 122 | &ps->client_ctx, |
127 | NULL); | 123 | NULL); |
128 | GNUNET_break (GNUNET_YES == | 124 | GNUNET_break(GNUNET_YES == |
129 | GNUNET_CONTAINER_multihashmap32_remove (pm->sessions, | 125 | GNUNET_CONTAINER_multihashmap32_remove(pm->sessions, |
130 | key, | 126 | key, |
131 | ps)); | 127 | ps)); |
132 | GNUNET_break (NULL == ps->client_ctx); | 128 | GNUNET_break(NULL == ps->client_ctx); |
133 | GNUNET_free (ps); | 129 | GNUNET_free(ps); |
134 | return GNUNET_OK; | 130 | return GNUNET_OK; |
135 | } | 131 | } |
136 | 132 | ||
@@ -141,17 +137,17 @@ free_entry (void *cls, | |||
141 | * @param pm our context | 137 | * @param pm our context |
142 | */ | 138 | */ |
143 | static void | 139 | static void |
144 | reconnect_plugin_ctx (struct GNUNET_TRANSPORT_PluginMonitor *pm) | 140 | reconnect_plugin_ctx(struct GNUNET_TRANSPORT_PluginMonitor *pm) |
145 | { | 141 | { |
146 | GNUNET_MQ_destroy (pm->mq); | 142 | GNUNET_MQ_destroy(pm->mq); |
147 | pm->mq = NULL; | 143 | pm->mq = NULL; |
148 | GNUNET_CONTAINER_multihashmap32_iterate (pm->sessions, | 144 | GNUNET_CONTAINER_multihashmap32_iterate(pm->sessions, |
149 | &free_entry, | 145 | &free_entry, |
150 | pm); | 146 | pm); |
151 | pm->backoff = GNUNET_TIME_STD_BACKOFF (pm->backoff); | 147 | pm->backoff = GNUNET_TIME_STD_BACKOFF(pm->backoff); |
152 | pm->reconnect_task = GNUNET_SCHEDULER_add_delayed (pm->backoff, | 148 | pm->reconnect_task = GNUNET_SCHEDULER_add_delayed(pm->backoff, |
153 | &do_plugin_connect, | 149 | &do_plugin_connect, |
154 | pm); | 150 | pm); |
155 | } | 151 | } |
156 | 152 | ||
157 | 153 | ||
@@ -162,18 +158,16 @@ reconnect_plugin_ctx (struct GNUNET_TRANSPORT_PluginMonitor *pm) | |||
162 | * @return 32-bit hash map index | 158 | * @return 32-bit hash map index |
163 | */ | 159 | */ |
164 | static uint32_t | 160 | static uint32_t |
165 | wrap_id (uint64_t id) | 161 | wrap_id(uint64_t id) |
166 | { | 162 | { |
167 | return ((uint32_t) id) ^ ((uint32_t) (id >> 32)); | 163 | return ((uint32_t)id) ^ ((uint32_t)(id >> 32)); |
168 | } | 164 | } |
169 | 165 | ||
170 | 166 | ||
171 | /** | 167 | /** |
172 | * Context for #locate_by_id(). | 168 | * Context for #locate_by_id(). |
173 | */ | 169 | */ |
174 | struct SearchContext | 170 | struct SearchContext { |
175 | { | ||
176 | |||
177 | /** | 171 | /** |
178 | * Result. | 172 | * Result. |
179 | */ | 173 | */ |
@@ -183,7 +177,6 @@ struct SearchContext | |||
183 | * ID to locate. | 177 | * ID to locate. |
184 | */ | 178 | */ |
185 | uint64_t session_id; | 179 | uint64_t session_id; |
186 | |||
187 | }; | 180 | }; |
188 | 181 | ||
189 | 182 | ||
@@ -196,18 +189,18 @@ struct SearchContext | |||
196 | * @return #GNUNET_OK (continue to iterate), or #GNUNET_SYSERR (match found) | 189 | * @return #GNUNET_OK (continue to iterate), or #GNUNET_SYSERR (match found) |
197 | */ | 190 | */ |
198 | static int | 191 | static int |
199 | locate_by_id (void *cls, | 192 | locate_by_id(void *cls, |
200 | uint32_t key, | 193 | uint32_t key, |
201 | void *value) | 194 | void *value) |
202 | { | 195 | { |
203 | struct SearchContext *sc = cls; | 196 | struct SearchContext *sc = cls; |
204 | struct GNUNET_TRANSPORT_PluginSession *ps = value; | 197 | struct GNUNET_TRANSPORT_PluginSession *ps = value; |
205 | 198 | ||
206 | if (sc->session_id == ps->session_id) | 199 | if (sc->session_id == ps->session_id) |
207 | { | 200 | { |
208 | sc->ps = ps; | 201 | sc->ps = ps; |
209 | return GNUNET_SYSERR; | 202 | return GNUNET_SYSERR; |
210 | } | 203 | } |
211 | return GNUNET_OK; | 204 | return GNUNET_OK; |
212 | } | 205 | } |
213 | 206 | ||
@@ -220,25 +213,25 @@ locate_by_id (void *cls, | |||
220 | * @return #GNUNET_Ok if message is well-formed | 213 | * @return #GNUNET_Ok if message is well-formed |
221 | */ | 214 | */ |
222 | static int | 215 | static int |
223 | check_event (void *cls, | 216 | check_event(void *cls, |
224 | const struct TransportPluginMonitorMessage *tpmm) | 217 | const struct TransportPluginMonitorMessage *tpmm) |
225 | { | 218 | { |
226 | const char *pname; | 219 | const char *pname; |
227 | size_t pname_len; | 220 | size_t pname_len; |
228 | size_t paddr_len; | 221 | size_t paddr_len; |
229 | 222 | ||
230 | pname = (const char *) &tpmm[1]; | 223 | pname = (const char *)&tpmm[1]; |
231 | pname_len = ntohs (tpmm->plugin_name_len); | 224 | pname_len = ntohs(tpmm->plugin_name_len); |
232 | paddr_len = ntohs (tpmm->plugin_address_len); | 225 | paddr_len = ntohs(tpmm->plugin_address_len); |
233 | if ( (pname_len + | 226 | if ((pname_len + |
234 | paddr_len + | 227 | paddr_len + |
235 | sizeof (struct TransportPluginMonitorMessage) != ntohs (tpmm->header.size)) || | 228 | sizeof(struct TransportPluginMonitorMessage) != ntohs(tpmm->header.size)) || |
236 | ( (0 != pname_len) && | 229 | ((0 != pname_len) && |
237 | ('\0' != pname[pname_len - 1]) ) ) | 230 | ('\0' != pname[pname_len - 1]))) |
238 | { | 231 | { |
239 | GNUNET_break (0); | 232 | GNUNET_break(0); |
240 | return GNUNET_SYSERR; | 233 | return GNUNET_SYSERR; |
241 | } | 234 | } |
242 | return GNUNET_OK; | 235 | return GNUNET_OK; |
243 | } | 236 | } |
244 | 237 | ||
@@ -250,8 +243,8 @@ check_event (void *cls, | |||
250 | * @paramm tpmm message with event data | 243 | * @paramm tpmm message with event data |
251 | */ | 244 | */ |
252 | static void | 245 | static void |
253 | handle_event (void *cls, | 246 | handle_event(void *cls, |
254 | const struct TransportPluginMonitorMessage *tpmm) | 247 | const struct TransportPluginMonitorMessage *tpmm) |
255 | { | 248 | { |
256 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; | 249 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; |
257 | struct GNUNET_TRANSPORT_PluginSession *ps; | 250 | struct GNUNET_TRANSPORT_PluginSession *ps; |
@@ -264,64 +257,63 @@ handle_event (void *cls, | |||
264 | struct GNUNET_HELLO_Address addr; | 257 | struct GNUNET_HELLO_Address addr; |
265 | struct SearchContext rv; | 258 | struct SearchContext rv; |
266 | 259 | ||
267 | pname = (const char *) &tpmm[1]; | 260 | pname = (const char *)&tpmm[1]; |
268 | pname_len = ntohs (tpmm->plugin_name_len); | 261 | pname_len = ntohs(tpmm->plugin_name_len); |
269 | paddr_len = ntohs (tpmm->plugin_address_len); | 262 | paddr_len = ntohs(tpmm->plugin_address_len); |
270 | paddr = &pname[pname_len]; | 263 | paddr = &pname[pname_len]; |
271 | ps = NULL; | 264 | ps = NULL; |
272 | ss = (enum GNUNET_TRANSPORT_SessionState) ntohs (tpmm->session_state); | 265 | ss = (enum GNUNET_TRANSPORT_SessionState)ntohs(tpmm->session_state); |
273 | if (GNUNET_TRANSPORT_SS_INIT == ss) | 266 | if (GNUNET_TRANSPORT_SS_INIT == ss) |
274 | { | 267 | { |
275 | ps = GNUNET_new (struct GNUNET_TRANSPORT_PluginSession); | 268 | ps = GNUNET_new(struct GNUNET_TRANSPORT_PluginSession); |
276 | ps->session_id = tpmm->session_id; | 269 | ps->session_id = tpmm->session_id; |
277 | (void) GNUNET_CONTAINER_multihashmap32_put (pm->sessions, | 270 | (void)GNUNET_CONTAINER_multihashmap32_put(pm->sessions, |
278 | wrap_id (tpmm->session_id), | 271 | wrap_id(tpmm->session_id), |
279 | ps, | 272 | ps, |
280 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 273 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
281 | 274 | } | |
282 | } | ||
283 | else | 275 | else |
284 | { | 276 | { |
285 | rv.session_id = tpmm->session_id; | 277 | rv.session_id = tpmm->session_id; |
286 | rv.ps = NULL; | 278 | rv.ps = NULL; |
287 | (void) GNUNET_CONTAINER_multihashmap32_get_multiple (pm->sessions, | 279 | (void)GNUNET_CONTAINER_multihashmap32_get_multiple(pm->sessions, |
288 | wrap_id (tpmm->session_id), | 280 | wrap_id(tpmm->session_id), |
289 | &locate_by_id, | 281 | &locate_by_id, |
290 | &rv); | 282 | &rv); |
291 | ps = rv.ps; | 283 | ps = rv.ps; |
292 | if (NULL == ps) | 284 | if (NULL == ps) |
293 | { | 285 | { |
294 | GNUNET_break (0); | 286 | GNUNET_break(0); |
295 | reconnect_plugin_ctx (pm); | 287 | reconnect_plugin_ctx(pm); |
296 | return; | 288 | return; |
289 | } | ||
297 | } | 290 | } |
298 | } | ||
299 | info.state = ss; | 291 | info.state = ss; |
300 | info.is_inbound = (int16_t) ntohs (tpmm->is_inbound); | 292 | info.is_inbound = (int16_t)ntohs(tpmm->is_inbound); |
301 | info.num_msg_pending = ntohl (tpmm->msgs_pending); | 293 | info.num_msg_pending = ntohl(tpmm->msgs_pending); |
302 | info.num_bytes_pending = ntohl (tpmm->bytes_pending); | 294 | info.num_bytes_pending = ntohl(tpmm->bytes_pending); |
303 | info.receive_delay = GNUNET_TIME_absolute_ntoh (tpmm->delay); | 295 | info.receive_delay = GNUNET_TIME_absolute_ntoh(tpmm->delay); |
304 | info.session_timeout = GNUNET_TIME_absolute_ntoh (tpmm->timeout); | 296 | info.session_timeout = GNUNET_TIME_absolute_ntoh(tpmm->timeout); |
305 | info.address = &addr; | 297 | info.address = &addr; |
306 | addr.peer = tpmm->peer; | 298 | addr.peer = tpmm->peer; |
307 | addr.address = (0 == paddr_len) ? NULL : paddr; | 299 | addr.address = (0 == paddr_len) ? NULL : paddr; |
308 | addr.address_length = paddr_len; | 300 | addr.address_length = paddr_len; |
309 | addr.transport_name = (0 == pname_len) ? NULL : pname; | 301 | addr.transport_name = (0 == pname_len) ? NULL : pname; |
310 | addr.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE; | 302 | addr.local_info = GNUNET_HELLO_ADDRESS_INFO_NONE; |
311 | pm->cb (pm->cb_cls, | 303 | pm->cb(pm->cb_cls, |
312 | ps, | 304 | ps, |
313 | &ps->client_ctx, | 305 | &ps->client_ctx, |
314 | &info); | 306 | &info); |
315 | 307 | ||
316 | if (GNUNET_TRANSPORT_SS_DONE == ss) | 308 | if (GNUNET_TRANSPORT_SS_DONE == ss) |
317 | { | 309 | { |
318 | GNUNET_break (NULL == ps->client_ctx); | 310 | GNUNET_break(NULL == ps->client_ctx); |
319 | GNUNET_assert (GNUNET_YES == | 311 | GNUNET_assert(GNUNET_YES == |
320 | GNUNET_CONTAINER_multihashmap32_remove (pm->sessions, | 312 | GNUNET_CONTAINER_multihashmap32_remove(pm->sessions, |
321 | wrap_id (tpmm->session_id), | 313 | wrap_id(tpmm->session_id), |
322 | ps)); | 314 | ps)); |
323 | GNUNET_free (ps); | 315 | GNUNET_free(ps); |
324 | } | 316 | } |
325 | } | 317 | } |
326 | 318 | ||
327 | 319 | ||
@@ -332,16 +324,16 @@ handle_event (void *cls, | |||
332 | * @param msg message from the service | 324 | * @param msg message from the service |
333 | */ | 325 | */ |
334 | static void | 326 | static void |
335 | handle_sync (void *cls, | 327 | handle_sync(void *cls, |
336 | const struct GNUNET_MessageHeader *msg) | 328 | const struct GNUNET_MessageHeader *msg) |
337 | { | 329 | { |
338 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; | 330 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; |
339 | 331 | ||
340 | /* we are in sync, notify callback */ | 332 | /* we are in sync, notify callback */ |
341 | pm->cb (pm->cb_cls, | 333 | pm->cb(pm->cb_cls, |
342 | NULL, | 334 | NULL, |
343 | NULL, | 335 | NULL, |
344 | NULL); | 336 | NULL); |
345 | } | 337 | } |
346 | 338 | ||
347 | 339 | ||
@@ -355,12 +347,12 @@ handle_sync (void *cls, | |||
355 | * @param error error code | 347 | * @param error error code |
356 | */ | 348 | */ |
357 | static void | 349 | static void |
358 | mq_error_handler (void *cls, | 350 | mq_error_handler(void *cls, |
359 | enum GNUNET_MQ_Error error) | 351 | enum GNUNET_MQ_Error error) |
360 | { | 352 | { |
361 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; | 353 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; |
362 | 354 | ||
363 | reconnect_plugin_ctx (pm); | 355 | reconnect_plugin_ctx(pm); |
364 | } | 356 | } |
365 | 357 | ||
366 | 358 | ||
@@ -370,35 +362,35 @@ mq_error_handler (void *cls, | |||
370 | * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *` | 362 | * @param cls our `struct GNUNET_TRANSPORT_PluginMonitor *` |
371 | */ | 363 | */ |
372 | static void | 364 | static void |
373 | do_plugin_connect (void *cls) | 365 | do_plugin_connect(void *cls) |
374 | { | 366 | { |
375 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; | 367 | struct GNUNET_TRANSPORT_PluginMonitor *pm = cls; |
376 | struct GNUNET_MQ_MessageHandler handlers[] = { | 368 | struct GNUNET_MQ_MessageHandler handlers[] = { |
377 | GNUNET_MQ_hd_var_size (event, | 369 | GNUNET_MQ_hd_var_size(event, |
378 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT, | 370 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_EVENT, |
379 | struct TransportPluginMonitorMessage, | 371 | struct TransportPluginMonitorMessage, |
380 | pm), | 372 | pm), |
381 | GNUNET_MQ_hd_fixed_size (sync, | 373 | GNUNET_MQ_hd_fixed_size(sync, |
382 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC, | 374 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC, |
383 | struct GNUNET_MessageHeader, | 375 | struct GNUNET_MessageHeader, |
384 | pm), | 376 | pm), |
385 | GNUNET_MQ_handler_end () | 377 | GNUNET_MQ_handler_end() |
386 | }; | 378 | }; |
387 | struct GNUNET_MessageHeader *msg; | 379 | struct GNUNET_MessageHeader *msg; |
388 | struct GNUNET_MQ_Envelope *env; | 380 | struct GNUNET_MQ_Envelope *env; |
389 | 381 | ||
390 | pm->reconnect_task = NULL; | 382 | pm->reconnect_task = NULL; |
391 | pm->mq = GNUNET_CLIENT_connect (pm->cfg, | 383 | pm->mq = GNUNET_CLIENT_connect(pm->cfg, |
392 | "transport", | 384 | "transport", |
393 | handlers, | 385 | handlers, |
394 | &mq_error_handler, | 386 | &mq_error_handler, |
395 | pm); | 387 | pm); |
396 | if (NULL == pm->mq) | 388 | if (NULL == pm->mq) |
397 | return; | 389 | return; |
398 | env = GNUNET_MQ_msg (msg, | 390 | env = GNUNET_MQ_msg(msg, |
399 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START); | 391 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_START); |
400 | GNUNET_MQ_send (pm->mq, | 392 | GNUNET_MQ_send(pm->mq, |
401 | env); | 393 | env); |
402 | } | 394 | } |
403 | 395 | ||
404 | 396 | ||
@@ -412,23 +404,23 @@ do_plugin_connect (void *cls) | |||
412 | * @return NULL on error, otherwise handle for cancellation | 404 | * @return NULL on error, otherwise handle for cancellation |
413 | */ | 405 | */ |
414 | struct GNUNET_TRANSPORT_PluginMonitor * | 406 | struct GNUNET_TRANSPORT_PluginMonitor * |
415 | GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg, | 407 | GNUNET_TRANSPORT_monitor_plugins(const struct GNUNET_CONFIGURATION_Handle *cfg, |
416 | GNUNET_TRANSPORT_SessionMonitorCallback cb, | 408 | GNUNET_TRANSPORT_SessionMonitorCallback cb, |
417 | void *cb_cls) | 409 | void *cb_cls) |
418 | { | 410 | { |
419 | struct GNUNET_TRANSPORT_PluginMonitor *pm; | 411 | struct GNUNET_TRANSPORT_PluginMonitor *pm; |
420 | 412 | ||
421 | pm = GNUNET_new (struct GNUNET_TRANSPORT_PluginMonitor); | 413 | pm = GNUNET_new(struct GNUNET_TRANSPORT_PluginMonitor); |
422 | pm->cb = cb; | 414 | pm->cb = cb; |
423 | pm->cb_cls = cb_cls; | 415 | pm->cb_cls = cb_cls; |
424 | pm->cfg = cfg; | 416 | pm->cfg = cfg; |
425 | do_plugin_connect (pm); | 417 | do_plugin_connect(pm); |
426 | if (NULL == pm->mq) | 418 | if (NULL == pm->mq) |
427 | { | 419 | { |
428 | GNUNET_free (pm); | 420 | GNUNET_free(pm); |
429 | return NULL; | 421 | return NULL; |
430 | } | 422 | } |
431 | pm->sessions = GNUNET_CONTAINER_multihashmap32_create (128); | 423 | pm->sessions = GNUNET_CONTAINER_multihashmap32_create(128); |
432 | return pm; | 424 | return pm; |
433 | } | 425 | } |
434 | 426 | ||
@@ -442,23 +434,23 @@ GNUNET_TRANSPORT_monitor_plugins (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
442 | * @param pm handle of the request that is to be cancelled | 434 | * @param pm handle of the request that is to be cancelled |
443 | */ | 435 | */ |
444 | void | 436 | void |
445 | GNUNET_TRANSPORT_monitor_plugins_cancel (struct GNUNET_TRANSPORT_PluginMonitor *pm) | 437 | GNUNET_TRANSPORT_monitor_plugins_cancel(struct GNUNET_TRANSPORT_PluginMonitor *pm) |
446 | { | 438 | { |
447 | if (NULL != pm->mq) | 439 | if (NULL != pm->mq) |
448 | { | 440 | { |
449 | GNUNET_MQ_destroy (pm->mq); | 441 | GNUNET_MQ_destroy(pm->mq); |
450 | pm->mq = NULL; | 442 | pm->mq = NULL; |
451 | } | 443 | } |
452 | if (NULL != pm->reconnect_task) | 444 | if (NULL != pm->reconnect_task) |
453 | { | 445 | { |
454 | GNUNET_SCHEDULER_cancel (pm->reconnect_task); | 446 | GNUNET_SCHEDULER_cancel(pm->reconnect_task); |
455 | pm->reconnect_task = NULL; | 447 | pm->reconnect_task = NULL; |
456 | } | 448 | } |
457 | GNUNET_CONTAINER_multihashmap32_iterate (pm->sessions, | 449 | GNUNET_CONTAINER_multihashmap32_iterate(pm->sessions, |
458 | &free_entry, | 450 | &free_entry, |
459 | pm); | 451 | pm); |
460 | GNUNET_CONTAINER_multihashmap32_destroy (pm->sessions); | 452 | GNUNET_CONTAINER_multihashmap32_destroy(pm->sessions); |
461 | GNUNET_free (pm); | 453 | GNUNET_free(pm); |
462 | } | 454 | } |
463 | 455 | ||
464 | 456 | ||