/**
* Return just the label of the hostname in @a req.
- *
+ *
* @param req request to process hostname of
* @return statically allocated pointer to the label,
* overwritten upon the next request!
{
static char label[64];
const char *dot;
-
+
dot = strchr (req->hostname,
(unsigned char) '.');
if (NULL == dot)
/**
* Build DNS query for @a hostname.
- *
+ *
* @param hostname host to build query for
* @param raw_size[out] number of bytes in the query
* @return NULL on error, otherwise pointer to statically (!)
rejects++;
GNUNET_break (0);
GNUNET_free (rawp);
- return NULL;
+ return NULL;
}
memcpy (raw,
rawp,
break;
case GNUNET_DNSPARSER_TYPE_DNAME:
/* No support for DNAME in GNS yet! FIXME: support later! */
- fprintf (stdout,
- "FIXME: not supported: %s DNAME %s\n",
- rec->name,
- rec->data.hostname);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "FIXME: not supported: %s DNAME %s\n",
+ rec->name,
+ rec->data.hostname);
break;
case GNUNET_DNSPARSER_TYPE_MX:
if (GNUNET_OK ==
int32_t success,
const char *emsg)
{
+ static struct GNUNET_TIME_Absolute last;
static unsigned int pdot;
struct Request *req = cls;
struct Record *rec;
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Stored records under `%s'\n",
req->hostname);
+ if (0 == pdot)
+ last = GNUNET_TIME_absolute_get ();
pdot++;
if (0 == pdot % 1000)
- fprintf (stderr, ".");
+ {
+ struct GNUNET_TIME_Relative delta;
+
+ delta = GNUNET_TIME_absolute_get_duration (last);
+ last = GNUNET_TIME_absolute_get ();
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Processed 1000 records in %s\n",
+ GNUNET_STRINGS_relative_time_to_string (delta,
+ GNUNET_YES));
+ }
}
/* Free records */
while (NULL != (rec = req->rec_head))
.req = req,
.p = p
};
-
+
for_all_records (p,
&process_record,
&prc);
static void
process_stdin (void *cls)
{
+ static struct GNUNET_TIME_Absolute last;
static unsigned int pdot;
char hn[256];
{
if (strlen(hn) > 0)
hn[strlen(hn)-1] = '\0'; /* eat newline */
+ if (0 == pdot)
+ last = GNUNET_TIME_absolute_get ();
pdot++;
if (0 == pdot % 1000)
- fprintf (stderr, ".");
+ {
+ struct GNUNET_TIME_Relative delta;
+
+ delta = GNUNET_TIME_absolute_get_duration (last);
+ last = GNUNET_TIME_absolute_get ();
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Imported 1000 records in %s\n",
+ GNUNET_STRINGS_relative_time_to_string (delta,
+ GNUNET_YES));
+ }
queue (hn);
return;
}