diff options
-rw-r--r-- | src/rps/Makefile.am | 7 | ||||
-rw-r--r-- | src/rps/rps-test_util.c | 47 | ||||
-rw-r--r-- | src/rps/rps-test_util.h | 3 |
3 files changed, 56 insertions, 1 deletions
diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am index 33e03af76..d477ade92 100644 --- a/src/rps/Makefile.am +++ b/src/rps/Makefile.am | |||
@@ -141,7 +141,12 @@ test_rps_seed_big_LDADD = $(ld_rps_test_lib) | |||
141 | test_rps_churn_SOURCES = $(rps_test_src) | 141 | test_rps_churn_SOURCES = $(rps_test_src) |
142 | test_rps_churn_LDADD = $(ld_rps_test_lib) | 142 | test_rps_churn_LDADD = $(ld_rps_test_lib) |
143 | 143 | ||
144 | gnunet_rps_profiler_SOURCES = $(rps_test_src) | 144 | gnunet_rps_profiler_SOURCES = \ |
145 | gnunet-service-rps_sampler_elem.h gnunet-service-rps_sampler_elem.c \ | ||
146 | rps-test_util.h rps-test_util.c \ | ||
147 | gnunet-rps-profiler.c | ||
148 | |||
149 | |||
145 | gnunet_rps_profiler_LDADD = \ | 150 | gnunet_rps_profiler_LDADD = \ |
146 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 151 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
147 | libgnunetrps.la \ | 152 | libgnunetrps.la \ |
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c index 0c81cc2b4..ea55deac5 100644 --- a/src/rps/rps-test_util.c +++ b/src/rps/rps-test_util.c | |||
@@ -107,6 +107,53 @@ to_file_ (const char *file_name, char *line) | |||
107 | "Unable to close file\n"); | 107 | "Unable to close file\n"); |
108 | } | 108 | } |
109 | 109 | ||
110 | void | ||
111 | to_file_raw (const char *file_name, void *buf, size_t size_buf) | ||
112 | { | ||
113 | struct GNUNET_DISK_FileHandle *f; | ||
114 | size_t size2; | ||
115 | |||
116 | |||
117 | if (NULL == (f = GNUNET_DISK_file_open (file_name, | ||
118 | GNUNET_DISK_OPEN_APPEND | | ||
119 | GNUNET_DISK_OPEN_WRITE | | ||
120 | GNUNET_DISK_OPEN_CREATE, | ||
121 | GNUNET_DISK_PERM_USER_READ | | ||
122 | GNUNET_DISK_PERM_USER_WRITE | | ||
123 | GNUNET_DISK_PERM_GROUP_READ | | ||
124 | GNUNET_DISK_PERM_OTHER_READ))) | ||
125 | { | ||
126 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
127 | "Not able to open file %s\n", | ||
128 | file_name); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | size2 = GNUNET_DISK_file_write (f, buf, size_buf); | ||
133 | if (size_buf != size2) | ||
134 | { | ||
135 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
136 | "Unable to write to file! (Size: %u, size2: %u)\n", | ||
137 | size_buf, | ||
138 | size2); | ||
139 | |||
140 | if (GNUNET_YES != GNUNET_DISK_file_close (f)) | ||
141 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
142 | "Unable to close file\n"); | ||
143 | |||
144 | return; | ||
145 | } | ||
146 | |||
147 | //if (512 < size_buf) | ||
148 | //{ | ||
149 | // GNUNET_free (output_buffer_p); | ||
150 | //} | ||
151 | |||
152 | //if (GNUNET_YES != GNUNET_DISK_file_close (f)) | ||
153 | // LOG (GNUNET_ERROR_TYPE_WARNING, | ||
154 | // "Unable to close file\n"); | ||
155 | } | ||
156 | |||
110 | char * | 157 | char * |
111 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) | 158 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) |
112 | { | 159 | { |
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h index 2213e50d8..d42422750 100644 --- a/src/rps/rps-test_util.h +++ b/src/rps/rps-test_util.h | |||
@@ -74,5 +74,8 @@ const char * | |||
74 | store_prefix_file_name (const struct GNUNET_PeerIdentity *peer, | 74 | store_prefix_file_name (const struct GNUNET_PeerIdentity *peer, |
75 | const char *prefix); | 75 | const char *prefix); |
76 | 76 | ||
77 | void | ||
78 | to_file_raw (const char *file_name, void *buf, size_t size_buf); | ||
79 | |||
77 | #endif /* RPS_TEST_UTIL_H */ | 80 | #endif /* RPS_TEST_UTIL_H */ |
78 | /* end of gnunet-service-rps.c */ | 81 | /* end of gnunet-service-rps.c */ |