*
* @param cls closure
* @param address NULL on error, otherwise 0-terminated printable UTF-8 string
+ * @param res result of the address to string conversion:
+ * if #GNUNET_OK: address was valid (conversion to
+ * string might still have failed)
+ * if #GNUNET_SYSERR: address is invalid
*/
static void
process_resolved_address (void *cls,
const char *address,
int res)
{
- struct AddressRecord * ar = cls;
+ struct AddressRecord *ar = cls;
struct PrintContext *pc = ar->pc;
if (NULL != address)
ar->result = GNUNET_strdup (address);
return;
}
-
ar->atsc = NULL;
if (GNUNET_SYSERR == res)
- {
- FPRINTF (stderr,
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_("Failure: Cannot convert address to string for peer `%s'\n"),
GNUNET_i2s (&ar->pc->peer));
- }
- else
- {
- pc->num_addresses++;
- }
+ pc->num_addresses++;
if (pc->num_addresses == pc->address_list_size)
dump_pc (pc);
}
{
struct PrintContext *pc = cls;
struct AddressRecord *ar;
+
GNUNET_assert (0 < pc->off);
ar = &pc->address_list[--pc->off];
ar->pc = pc;
ar->atsc = GNUNET_TRANSPORT_address_to_string (cfg,
address,
no_resolve,
- GNUNET_TIME_relative_multiply
- (GNUNET_TIME_UNIT_SECONDS, 10),
+ TIMEOUT,
&process_resolved_address, ar);
return GNUNET_OK;
}
friend_only = GNUNET_NO;
if (NULL != hello)
friend_only = GNUNET_HELLO_is_friend_only (hello);
- if ((GNUNET_YES == be_quiet) || (NULL == hello))
+ if ( (GNUNET_YES == be_quiet) ||
+ (NULL == hello) )
{
printf ("%s%s\n",
(GNUNET_YES == friend_only) ? "F2F: " : "",
}
pc->address_list_size = pc->off;
pc->address_list = GNUNET_malloc (sizeof (struct AddressRecord) * pc->off);
- GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
- &print_address, pc);
+ GNUNET_HELLO_iterate_addresses (hello,
+ GNUNET_NO,
+ &print_address,
+ pc);
}
/* ************************* DUMP Hello ************************** */
/**
- * Write Hello of my peer to a file.
+ * Write HELLO of my peer to a file.
*
* @param cls the `struct GetUriContext *`
* @param peer identity of the peer (unused)
{
struct GNUNET_HELLO_Message *hello = NULL;
- int ret = GNUNET_HELLO_parse_uri(put_uri,
- &my_peer_identity.public_key,
- &hello,
- &GPI_plugins_find);
+ int ret = GNUNET_HELLO_parse_uri (put_uri,
+ &my_peer_identity.public_key,
+ &hello,
+ &GPI_plugins_find);
if (NULL != hello)
{
tt = GNUNET_SCHEDULER_add_now (&state_machine, NULL);
GNUNET_free (hello);
}
-
- /* wait 1s to give peerinfo operation a chance to succeed */
- /* FIXME: current peerinfo API sucks to require this; not to mention
- that we get no feedback to determine if the operation actually succeeded */
return ret;
}