summaryrefslogtreecommitdiff
path: root/src/transport/transport_api_monitor_peers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-02 23:52:41 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-02 23:52:41 +0000
commit8135b399e1f9cac35602277806d71438def72010 (patch)
treeb5dd3fa535a0150f1acbe11fb2dd9a869e1868f9 /src/transport/transport_api_monitor_peers.c
parentf2d1198d45bc3786d0164a5b6df928768022d1b7 (diff)
-fix fix
Diffstat (limited to 'src/transport/transport_api_monitor_peers.c')
-rw-r--r--src/transport/transport_api_monitor_peers.c58
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,
return;
}
- if (0 == tlen)
+ if ( (0 == tlen) && (0 == alen) )
{
- GNUNET_break (0); /* This must not happen: address without plugin */
- return;
+ /* No address available */
+ pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, NULL,
+ ntohl(pir_msg->state),
+ GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
}
- addr = (const char *) &pir_msg[1];
- transport_name = &addr[alen];
-
- if (transport_name[tlen - 1] != '\0')
+ else
{
- /* Corrupt plugin name */
- GNUNET_break (0);
- if (pal_ctx->one_shot)
+ if (0 == tlen)
{
- pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL,
- GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS);
- GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx);
+ GNUNET_break (0); /* This must not happen: address without plugin */
+ return;
}
- else
+ addr = (const char *) &pir_msg[1];
+ transport_name = &addr[alen];
+
+ if (transport_name[tlen - 1] != '\0')
{
- reconnect_peer_ctx (pal_ctx);
+ /* Corrupt plugin name */
+ GNUNET_break (0);
+ if (pal_ctx->one_shot)
+ {
+ pal_ctx->cb (pal_ctx->cb_cls, NULL, NULL,
+ GNUNET_TRANSPORT_PS_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS);
+ GNUNET_TRANSPORT_monitor_peers_cancel (pal_ctx);
+ }
+ else
+ {
+ reconnect_peer_ctx (pal_ctx);
+ }
+ return;
}
- return;
- }
- /* notify client */
- address = GNUNET_HELLO_address_allocate (&pir_msg->peer,
- transport_name, addr, alen, ntohl(pir_msg->local_address_info));
- pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, address,
- ntohl(pir_msg->state),
- GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
- GNUNET_HELLO_address_free (address);
+ /* notify client */
+ address = GNUNET_HELLO_address_allocate (&pir_msg->peer,
+ transport_name, addr, alen, ntohl(pir_msg->local_address_info));
+ pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, address,
+ ntohl(pir_msg->state),
+ GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
+ GNUNET_HELLO_address_free (address);
+ }
/* expect more replies */
GNUNET_CLIENT_receive (pal_ctx->client, &peer_response_processor,