#endif
smallWorldConnections = 0;
small_world_it = (unsigned int)(natLog * percentage);
+ if (small_world_it < 1)
+ small_world_it = 1;
GNUNET_assert(small_world_it > 0 && small_world_it < (unsigned int)-1);
for (i = 0; i < small_world_it; i++)
{
FILE *temp_friend_handle;
unsigned int pg_iter;
char *temp_service_path;
- pid_t *pidarr;
+ struct GNUNET_OS_Process **procarr;
char *arg;
char * mytemp;
enum GNUNET_OS_ProcessStatusType type;
int ret;
int max_wait = 10;
- pidarr = GNUNET_malloc(sizeof(pid_t) * pg->total);
+ procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total);
for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
{
mytemp = GNUNET_DISK_mktemp("friends");
if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */
{
GNUNET_asprintf (&arg, "%s/friends", temp_service_path);
- pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
+ procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
"mv", mytemp, arg, NULL);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_asprintf (&arg, "%s@%s:%s/friends", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path);
else
GNUNET_asprintf (&arg, "%s:%s/friends", pg->peers[pg_iter].daemon->hostname, temp_service_path);
- pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
+ procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
"scp", mytemp, arg, NULL);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("Checking copy status of file %d\n"), pg_iter);
#endif
- if (pidarr[pg_iter] != 0) /* Check for already completed! */
+ if (procarr[pg_iter] != NULL) /* Check for already completed! */
{
- if (GNUNET_OS_process_status(pidarr[pg_iter], &type, &return_code) != GNUNET_OK)
+ if (GNUNET_OS_process_status(procarr[pg_iter], &type, &return_code) != GNUNET_OK)
{
ret = GNUNET_SYSERR;
}
}
else
{
- pidarr[pg_iter] = 0;
+ GNUNET_OS_process_close (procarr[pg_iter]);
+ procarr[pg_iter] = NULL;
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("File %d copied\n"), pg_iter);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("Finished copying all friend files!\n"));
#endif
- GNUNET_free(pidarr);
+ GNUNET_free(procarr);
return ret;
}
static struct BlacklistContext blacklist_ctx;
unsigned int pg_iter;
char *temp_service_path;
- pid_t *pidarr;
+ struct GNUNET_OS_Process **procarr;
char *arg;
char *mytemp;
enum GNUNET_OS_ProcessStatusType type;
char *pos;
char *temp_transports;
- pidarr = GNUNET_malloc(sizeof(pid_t) * pg->total);
+ procarr = GNUNET_malloc(sizeof(struct GNUNET_OS_Process *) * pg->total);
for (pg_iter = 0; pg_iter < pg->total; pg_iter++)
{
mytemp = GNUNET_DISK_mktemp("blacklist");
if (pg->peers[pg_iter].daemon->hostname == NULL) /* Local, just copy the file */
{
GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path);
- pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
+ procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "mv",
"mv", mytemp, arg, NULL);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GNUNET_asprintf (&arg, "%s@%s:%s/blacklist", pg->peers[pg_iter].daemon->username, pg->peers[pg_iter].daemon->hostname, temp_service_path);
else
GNUNET_asprintf (&arg, "%s:%s/blacklist", pg->peers[pg_iter].daemon->hostname, temp_service_path);
- pidarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
+ procarr[pg_iter] = GNUNET_OS_start_process (NULL, NULL, "scp",
"scp", mytemp, arg, NULL);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("Checking copy status of file %d\n"), pg_iter);
#endif
- if (pidarr[pg_iter] != 0) /* Check for already completed! */
+ if (procarr[pg_iter] != NULL) /* Check for already completed! */
{
- if (GNUNET_OS_process_status(pidarr[pg_iter], &type, &return_code) != GNUNET_OK)
+ if (GNUNET_OS_process_status(procarr[pg_iter], &type, &return_code) != GNUNET_OK)
{
ret = GNUNET_SYSERR;
}
}
else
{
- pidarr[pg_iter] = 0;
+ GNUNET_OS_process_close (procarr[pg_iter]);
+ procarr[pg_iter] = NULL;
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("File %d copied\n"), pg_iter);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("Finished copying all blacklist files!\n"));
#endif
- GNUNET_free(pidarr);
+ GNUNET_free(procarr);
return ret;
}
total = total + ret;
#if OLD
- connection_iter = ;
+ connection_iter = FIXME;
while (connection_iter != NULL)
{
connect_context = GNUNET_malloc(sizeof(struct ConnectContext));
connect_context->pg = pg;
- connect_context->first = ;
+ connect_context->first = FIXME;
connect_context->second = connection_iter->daemon;
GNUNET_SCHEDULER_add_now(pg->sched, &schedule_connect, connect_context);
connection_iter = connection_iter->next;