X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=octopi%2Flibrary%2Ftests_sockets%2Fspocket_tester.cpp;h=3fac9bb8a5bf3740096c969f598e1839d7595ff7;hb=9dd72bf7c3c75823ba325948fb7b1089ab18b8ec;hp=d5f731c0de5fceb2c79a1340a2c6bb423b7a1bb5;hpb=2952ccf47b80174880141a7ecfa122089f349b8d;p=feisty_meow.git diff --git a/octopi/library/tests_sockets/spocket_tester.cpp b/octopi/library/tests_sockets/spocket_tester.cpp index d5f731c0..3fac9bb8 100644 --- a/octopi/library/tests_sockets/spocket_tester.cpp +++ b/octopi/library/tests_sockets/spocket_tester.cpp @@ -30,16 +30,13 @@ #include -//using namespace application; using namespace basis; -//using namespace filesystem; using namespace loggers; using namespace mathematics; using namespace sockets; using namespace structures; using namespace textual; using namespace timely; -//using namespace unit_test; #define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print)) @@ -105,9 +102,10 @@ bool spocket_tester::accept(bool wait) ret = _root_server->accept(_socket, false); if (ret == spocket::OKAY) break; if (ret != spocket::NO_CONNECTION) break; - if (!wait) return true; // we accepted at least once. - time_control::sleep_ms(100); + if (!wait) return true; // we tried to accept at least once. + time_control::sleep_ms(100); // snooze to avoid slamming with accepts. } + return ret == spocket::OKAY; } @@ -180,7 +178,6 @@ bool spocket_tester::do_a_receive(int size_expected, testing_statistics &stats) if (ret != spocket::OKAY) { if (ret == spocket::NONE_READY) { if (len != 0) LOG(a_sprintf("supposedly nothing was received (%d bytes)", len)); -/// time_control::sleep_ms(PAUSE_TIME); _socket->await_readable(PAUSE_TIME); continue; } else break; @@ -220,10 +217,6 @@ if (len != 0) LOG(a_sprintf("supposedly nothing was received (%d bytes)", len)); bool spocket_tester::perform_test(int size, int count, testing_statistics &stats) { -#ifdef DEBUG_SPOCKET_TESTER - LOG("into perf test"); -#endif - // the statics are used to generate our random buffer for sending. static abyte garbage_buffer[MAXIMUM_WINSOCK_MTU + 1]; static bool garbage_initialized = false; @@ -232,12 +225,10 @@ bool spocket_tester::perform_test(int size, int count, // if our static buffer full of random stuff was never initialized, we do // so now. this supports efficiently re-using the tester if desired. if (!garbage_initialized) { - LOG("initializing random send buffer."); // note the less than or equal; we know we have one more byte to fill. for (int i = 0; i <= MAXIMUM_WINSOCK_MTU; i++) garbage_buffer[i] = randomizer.inclusive(0, 255); garbage_initialized = true; - LOG("random send buffer initialized."); } // reset the statistical package.