aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_transport_api_limited_sockets.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_transport_api_limited_sockets.c')
-rw-r--r--src/transport/test_transport_api_limited_sockets.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 0dc6c2a86..9e7bdb9b6 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -284,6 +284,7 @@ main (int argc, char *argv[])
284{ 284{
285 int ret = 0; 285 int ret = 0;
286 int nat_res; 286 int nat_res;
287
287 test_plugin = NULL; 288 test_plugin = NULL;
288 289
289 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); 290 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
@@ -299,8 +300,9 @@ main (int argc, char *argv[])
299#endif 300#endif
300 NULL); 301 NULL);
301 302
302 if ((test_plugin != NULL) && ((strcmp (test_plugin, "tcp_nat") == 0) || 303 if ((test_plugin != NULL) &&
303 (strcmp (test_plugin, "udp_nat") == 0))) 304 ((strcmp (test_plugin, "tcp_nat") == 0) ||
305 (strcmp (test_plugin, "udp_nat") == 0)))
304 { 306 {
305 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); 307 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
306 if (GNUNET_NO == nat_res) 308 if (GNUNET_NO == nat_res)
@@ -329,13 +331,17 @@ main (int argc, char *argv[])
329 struct rlimit r_file_old; 331 struct rlimit r_file_old;
330 struct rlimit r_file_new; 332 struct rlimit r_file_new;
331 int res; 333 int res;
332 res = getrlimit(RLIMIT_NOFILE, &r_file_old);
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur, r_file_old.rlim_max);
334 334
335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting maximum number of open files to: %u\n", MAX_FILES); 335 res = getrlimit (RLIMIT_NOFILE, &r_file_old);
336 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
337 "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur,
338 r_file_old.rlim_max);
339
340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
341 "Setting maximum number of open files to: %u\n", MAX_FILES);
336 r_file_new.rlim_cur = MAX_FILES; 342 r_file_new.rlim_cur = MAX_FILES;
337 r_file_new.rlim_max = r_file_old.rlim_max; 343 r_file_new.rlim_max = r_file_old.rlim_max;
338 res = setrlimit(RLIMIT_NOFILE, &r_file_new); 344 res = setrlimit (RLIMIT_NOFILE, &r_file_new);
339 345
340 if (res != 0) 346 if (res != 0)
341 { 347 {
@@ -360,8 +366,9 @@ main (int argc, char *argv[])
360 GNUNET_free (test_name); 366 GNUNET_free (test_name);
361 367
362#if HAVE_SETRLIMIT 368#if HAVE_SETRLIMIT
363 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring previous value maximum number of open files\n"); 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
364 res = setrlimit(RLIMIT_NOFILE, &r_file_old); 370 "Restoring previous value maximum number of open files\n");
371 res = setrlimit (RLIMIT_NOFILE, &r_file_old);
365 if (res != 0) 372 if (res != 0)
366 { 373 {
367 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n"); 374 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n");