aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-25 22:28:06 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-25 22:28:06 +0000
commit3308b6e4c666bd9a78e3312e21a5595ddb16fe41 (patch)
tree3bef125732bfac3796c4b41581f69117ced95ee5 /src
parent7163fd6dae38f2e90b40f28f2439eeb46906739b (diff)
downloadgnunet-3308b6e4c666bd9a78e3312e21a5595ddb16fe41.tar.gz
gnunet-3308b6e4c666bd9a78e3312e21a5595ddb16fe41.zip
remove dead/ugly code
Diffstat (limited to 'src')
-rw-r--r--src/testbed/test_testbed_logger_api.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/src/testbed/test_testbed_logger_api.c b/src/testbed/test_testbed_logger_api.c
index bedb9d4da..30740c94d 100644
--- a/src/testbed/test_testbed_logger_api.c
+++ b/src/testbed/test_testbed_logger_api.c
@@ -112,15 +112,11 @@ do_abort (void *cls)
112 * Function called to iterate over a directory. 112 * Function called to iterate over a directory.
113 * 113 *
114 * @param cls closure 114 * @param cls closure
115 * @param di argument to pass to "GNUNET_DISK_directory_iterator_next" to
116 * get called on the next entry (or finish cleanly);
117 * NULL on error (will be the last call in that case)
118 * @param filename complete filename (absolute path) 115 * @param filename complete filename (absolute path)
119 * @param dirname directory name (absolute path)
120 */ 116 */
121static void 117static void
122iterator_cb (void *cls, struct GNUNET_DISK_DirectoryIterator *di, 118iterator_cb (void *cls,
123 const char *filename, const char *dirname) 119 const char *filename)
124{ 120{
125 const char *fn; 121 const char *fn;
126 size_t len; 122 size_t len;
@@ -129,30 +125,24 @@ iterator_cb (void *cls, struct GNUNET_DISK_DirectoryIterator *di,
129 125
130 cancel = GNUNET_NO; 126 cancel = GNUNET_NO;
131 if (NULL == filename) 127 if (NULL == filename)
132 goto iteration_cont; 128 return;
133 len = strlen (filename); 129 len = strlen (filename);
134 if (len < 5) /* log file: `pid'.dat */ 130 if (len < 5) /* log file: `pid'.dat */
135 goto iteration_cont; 131 return;
136 fn = filename + len; 132 fn = filename + len;
137 if (0 != strcasecmp (".dat", fn - 4)) 133 if (0 != strcasecmp (".dat", fn - 4))
138 goto iteration_cont; 134 return;
139 if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, 135 if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs,
140 GNUNET_NO, GNUNET_YES)) 136 GNUNET_NO, GNUNET_YES))
141 goto iteration_cont; 137 return;
142 if ((BSIZE * 2) != fs) /* The file size should be equal to what we 138 if ((BSIZE * 2) != fs) /* The file size should be equal to what we
143 have written */ 139 have written */
144 goto iteration_cont; 140 return;
145
146 cancel = GNUNET_YES; 141 cancel = GNUNET_YES;
147 result = GNUNET_OK; 142 result = GNUNET_OK;
148
149 iteration_cont:
150 if ( (NULL != di) &&
151 (GNUNET_YES == GNUNET_DISK_directory_iterator_next (di, cancel)) )
152 return;
153 shutdown_now ();
154} 143}
155 144
145
156/** 146/**
157 * Functions of this type are called to notify a successful transmission of the 147 * Functions of this type are called to notify a successful transmission of the
158 * message to the logger service 148 * message to the logger service
@@ -166,9 +156,12 @@ flush_comp (void *cls, size_t size)
166 FAIL_TEST (&write_task == cls, return); 156 FAIL_TEST (&write_task == cls, return);
167 FAIL_TEST ((BSIZE * 2) == size, return); 157 FAIL_TEST ((BSIZE * 2) == size, return);
168 FAIL_TEST (GNUNET_OK == GNUNET_TESTING_peer_stop (peer), return); 158 FAIL_TEST (GNUNET_OK == GNUNET_TESTING_peer_stop (peer), return);
169 FAIL_TEST (GNUNET_YES == GNUNET_DISK_directory_iterator_start 159 FAIL_TEST (GNUNET_SYSERR !=
170 (GNUNET_SCHEDULER_PRIORITY_DEFAULT, search_dir, 160 GNUNET_DISK_directory_scan (search_dir,
171 &iterator_cb, NULL), return); 161 &iterator_cb,
162 NULL),
163 return);
164 shutdown_now ();
172} 165}
173 166
174 167
@@ -180,26 +173,30 @@ do_write (void *cls)
180 173
181 write_task = NULL; 174 write_task = NULL;
182 if (0 == i) 175 if (0 == i)
183 write_task = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS(1), &do_write, NULL); 176 write_task = GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS(1),
177 &do_write,
178 NULL);
184 (void) memset (buf, i, BSIZE); 179 (void) memset (buf, i, BSIZE);
185 GNUNET_TESTBED_LOGGER_write (h, buf, BSIZE); 180 GNUNET_TESTBED_LOGGER_write (h, buf, BSIZE);
186 if (0 == i++) 181 if (0 == i++)
187 return; 182 return;
188 GNUNET_TESTBED_LOGGER_flush (h, GNUNET_TIME_UNIT_FOREVER_REL, 183 GNUNET_TESTBED_LOGGER_flush (h,
184 GNUNET_TIME_UNIT_FOREVER_REL,
189 &flush_comp, &write_task); 185 &flush_comp, &write_task);
190} 186}
191 187
192 188
193/** 189/**
194 * Signature of the 'main' function for a (single-peer) testcase that 190 * Signature of the 'main' function for a (single-peer) testcase that
195 * is run using 'GNUNET_TESTING_peer_run'. 191 * is run using #GNUNET_TESTING_peer_run().
196 * 192 *
197 * @param cls closure 193 * @param cls closure
198 * @param cfg configuration of the peer that was started 194 * @param cfg configuration of the peer that was started
199 * @param peer identity of the peer that was created 195 * @param peer identity of the peer that was created
200 */ 196 */
201static void 197static void
202test_main (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, 198test_main (void *cls,
199 const struct GNUNET_CONFIGURATION_Handle *cfg,
203 struct GNUNET_TESTING_Peer *p) 200 struct GNUNET_TESTING_Peer *p)
204{ 201{
205 FAIL_TEST (NULL != (h = GNUNET_TESTBED_LOGGER_connect (cfg)), return); 202 FAIL_TEST (NULL != (h = GNUNET_TESTBED_LOGGER_connect (cfg)), return);