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