[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26745 - gnunet/src/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26745 - gnunet/src/testing |
Date: |
Wed, 3 Apr 2013 23:17:41 +0200 |
Author: harsha
Date: 2013-04-03 23:17:41 +0200 (Wed, 03 Apr 2013)
New Revision: 26745
Modified:
gnunet/src/testing/testing.c
Log:
- reduce open file descriptors in processes started through testing
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2013-04-03 16:04:47 UTC (rev 26744)
+++ gnunet/src/testing/testing.c 2013-04-03 21:17:41 UTC (rev 26745)
@@ -92,16 +92,6 @@
char *hostkeys_data;
/**
- * memory map for 'hostkeys_data'.
- */
- struct GNUNET_DISK_MapHandle *map;
-
- /**
- * File descriptor for the map.
- */
- struct GNUNET_DISK_FileHandle *map_fd;
-
- /**
* Bitmap where each TCP port that has already been reserved for
* some GNUnet peer is recorded. Note that we additionally need to
* test if a port is already in use by non-GNUnet components before
@@ -272,19 +262,15 @@
GNUNET_free (filename);
return GNUNET_SYSERR;
}
- system->map_fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
- GNUNET_DISK_PERM_NONE);
- if (NULL == system->map_fd)
+ system->hostkeys_data = GNUNET_malloc_large ((size_t) fs);
+ if (GNUNET_DISK_fn_read (filename, system->hostkeys_data, fs) != (ssize_t)
fs)
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename);
GNUNET_free (filename);
+ GNUNET_free (system->hostkeys_data);
+ system->hostkeys_data = NULL;
return GNUNET_SYSERR;
}
system->total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
- system->hostkeys_data = GNUNET_DISK_file_map (system->map_fd,
- &system->map,
- GNUNET_DISK_MAP_TYPE_READ,
- fs);
GNUNET_free (filename);
return GNUNET_OK;
}
@@ -299,12 +285,8 @@
hostkeys_unload (struct GNUNET_TESTING_System *system)
{
GNUNET_break (NULL != system->hostkeys_data);
+ GNUNET_free_non_null (system->hostkeys_data);
system->hostkeys_data = NULL;
- GNUNET_DISK_file_unmap (system->map);
- system->map = NULL;
- GNUNET_DISK_file_close (system->map_fd);
- system->map_fd = NULL;
- system->hostkeys_data = NULL;
system->total_hostkeys = 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26745 - gnunet/src/testing,
gnunet <=