summaryrefslogtreecommitdiff
path: root/src/transport/transport_api_monitor_peers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-02 22:25:48 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-02 22:25:48 +0000
commit69c3a52cfa679175da8f06bdcb8e2e4195465e44 (patch)
tree73109126cfcf1a807c5dc1e778f40b955fc959c5 /src/transport/transport_api_monitor_peers.c
parentc42deb089faffd654e27bf661ce85d5c1bb38b7a (diff)
avoid passing both PeerIdentity and Address (which contains PeerIdentity) if address is always present as then this is redundant
Diffstat (limited to 'src/transport/transport_api_monitor_peers.c')
-rw-r--r--src/transport/transport_api_monitor_peers.c58
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,
return;
}
- if ( (0 == tlen) && (0 == alen) )
+ if (0 == tlen)
{
- /* 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));
+ 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')
{
- if (0 == tlen)
+ /* Corrupt plugin name */
+ GNUNET_break (0);
+ if (pal_ctx->one_shot)
{
- GNUNET_break (0); /* This must not happen: address without plugin */
- return;
+ 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);
}
- 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)
- {
- 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;
+ reconnect_peer_ctx (pal_ctx);
}
+ 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,