- GNUNET_break (0);
- return 0;
- }
- if (0 == size)
- {
- GNUNET_break (0);
- return 0;
- }
- buf = GNUNET_malloc (size + 1);
- rsize = GNUNET_DISK_fn_read (hostfile, buf, (size_t) size);
- if ( (GNUNET_SYSERR == rsize) || ((ssize_t) size != rsize) )
- {
- GNUNET_free (buf);
- GNUNET_break (0);
- return 0;
- }
- size++;
- offset = 0;
- pstep = SCAN;
- hostname = NULL;
- while (offset < size)
- {
- switch (pstep)
- {
- case SCAN:
- if ('!' == buf[offset])
- pstep = SKIP;
- else
- pstep = TRIM;
- break;
- case SKIP:
- if ('\n' == buf[offset])
- pstep = SCAN;
- break;
- case TRIM:
- if ('!' == buf[offset])
- {
- pstep = SKIP;
- break;
- }
- if ( (' ' == buf[offset])
- || ('\t' == buf[offset])
- || ('\r' == buf[offset]) )
- pstep = TRIM;
- else
- {
- pstep = READHOST;
- hostname = &buf[offset];
- }
- break;
- case READHOST:
- if (isspace (buf[offset]))
- {
- buf[offset] = '\0';
- for (host = 0; host < nhosts; host++)
- if (0 == strcmp (hostnames[host], hostname))
- break;
- if (host == nhosts)
- {
- LOG_DEBUG ("Adding host: %s\n", hostname);
- hostname = GNUNET_strdup (hostname);
- GNUNET_array_append (hostnames, nhosts, hostname);
- }
- else
- LOG_DEBUG ("Not adding host %s as it is already included\n", hostname);
- hostname = NULL;
- pstep = SCAN;
- }
- break;
- }
- offset++;
+ child_death_task_id =
+ GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
+ pr, &child_death_task, NULL);
+ return;