diff options
Diffstat (limited to 'src/transport/transport_api_monitor_peers.c')
-rw-r--r-- | src/transport/transport_api_monitor_peers.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/src/transport/transport_api_monitor_peers.c b/src/transport/transport_api_monitor_peers.c index aaf1000f6..5b3fd64b8 100644 --- a/src/transport/transport_api_monitor_peers.c +++ b/src/transport/transport_api_monitor_peers.c | |||
@@ -333,49 +333,39 @@ peer_response_processor (void *cls, | |||
333 | return; | 333 | return; |
334 | } | 334 | } |
335 | 335 | ||
336 | if ( (0 == tlen) && (0 == alen) ) | 336 | if (0 == tlen) |
337 | { | 337 | { |
338 | /* No address available */ | 338 | GNUNET_break (0); /* This must not happen: address without plugin */ |
339 | pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, NULL, | 339 | return; |
340 | ntohl(pir_msg->state), | ||
341 | GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout)); | ||
342 | } | 340 | } |
343 | else | 341 | addr = (const char *) &pir_msg[1]; |
342 | transport_name = &addr[alen]; | ||
343 | |||
344 | if (transport_name[tlen - 1] != '\0') | ||
344 | { | 345 | { |
345 | if (0 == tlen) | 346 | /* Corrupt plugin name */ |
347 | GNUNET_break (0); | ||
348 | if (pal_ctx->one_shot) | ||
346 | { | 349 | { |
347 | GNUNET_break (0); /* This must not happen: address without plugin */ | 350 | pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL, |
348 | return; | 351 | GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS); |
352 | GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx); | ||
349 | } | 353 | } |
350 | addr = (const char *) &pir_msg[1]; | 354 | else |
351 | transport_name = &addr[alen]; | ||
352 | |||
353 | if (transport_name[tlen - 1] != '\0') | ||
354 | { | 355 | { |
355 | /* Corrupt plugin name */ | 356 | reconnect_peer_ctx (pal_ctx); |
356 | GNUNET_break (0); | ||
357 | if (pal_ctx->one_shot) | ||
358 | { | ||
359 | pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL, | ||
360 | GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS); | ||
361 | GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx); | ||
362 | } | ||
363 | else | ||
364 | { | ||
365 | reconnect_peer_ctx (pal_ctx); | ||
366 | } | ||
367 | return; | ||
368 | } | 357 | } |
358 | return; | ||
359 | } | ||
369 | 360 | ||
370 | /* notify client */ | 361 | /* notify client */ |
371 | address = GNUNET_HELLO_address_allocate (&pir_msg->peer, | 362 | address = GNUNET_HELLO_address_allocate (&pir_msg->peer, |
372 | transport_name, addr, alen, ntohl(pir_msg->local_address_info)); | 363 | transport_name, addr, alen, ntohl(pir_msg->local_address_info)); |
373 | pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, address, | 364 | pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, address, |
374 | ntohl(pir_msg->state), | 365 | ntohl(pir_msg->state), |
375 | GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout)); | 366 | GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout)); |
376 | GNUNET_HELLO_address_free (address); | 367 | GNUNET_HELLO_address_free (address); |
377 | 368 | ||
378 | } | ||
379 | 369 | ||
380 | /* expect more replies */ | 370 | /* expect more replies */ |
381 | GNUNET_CLIENT_receive (pal_ctx->client, &peer_response_processor, | 371 | GNUNET_CLIENT_receive (pal_ctx->client, &peer_response_processor, |