more timestamps in test logs
This commit is contained in:
parent
68db0038e5
commit
87ae3fd01a
|
@ -80,7 +80,7 @@ struct dht_server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "DHT initialized on port %d\n", m_port);
|
fprintf(stderr, "%s: DHT initialized on port %d\n", time_now_string(), m_port);
|
||||||
|
|
||||||
m_thread.reset(new thread(boost::bind(&dht_server::thread_fun, this)));
|
m_thread.reset(new thread(boost::bind(&dht_server::thread_fun, this)));
|
||||||
}
|
}
|
||||||
|
@ -165,8 +165,8 @@ int num_dht_hits()
|
||||||
|
|
||||||
void stop_dht()
|
void stop_dht()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "stop_dht()\n");
|
fprintf(stderr, "%s: stop_dht()\n", time_now_string());
|
||||||
g_dht.reset();
|
g_dht.reset();
|
||||||
fprintf(stderr, "done\n");
|
fprintf(stderr, "%s: stop_dht() done\n", time_now_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct peer_server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "peer initialized on port %d\n", m_port);
|
fprintf(stderr, "%s: peer initialized on port %d\n", time_now_string(), m_port);
|
||||||
|
|
||||||
m_thread.reset(new thread(boost::bind(&peer_server::thread_fun, this)));
|
m_thread.reset(new thread(boost::bind(&peer_server::thread_fun, this)));
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ struct peer_server
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "incoming peer connection\n");
|
fprintf(stderr, "%s: incoming peer connection\n", time_now_string());
|
||||||
++m_peer_requests;
|
++m_peer_requests;
|
||||||
socket.close(ec);
|
socket.close(ec);
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,8 @@ int num_peer_hits()
|
||||||
|
|
||||||
void stop_peer()
|
void stop_peer()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "stop_peer()\n");
|
fprintf(stderr, "%s: stop_peer()\n", time_now_string());
|
||||||
g_peer.reset();
|
g_peer.reset();
|
||||||
fprintf(stderr, "done\n");
|
fprintf(stderr, "%s: done\n", time_now_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -543,13 +543,13 @@ setup_transfer(session* ses1, session* ses2, session* ses3
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (use_ssl_ports)
|
if (use_ssl_ports)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ses1: connecting peer port: %d\n", int(ses2->ssl_listen_port()));
|
fprintf(stderr, "%s: ses1: connecting peer port: %d\n", time_now_string(), int(ses2->ssl_listen_port()));
|
||||||
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
|
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
|
||||||
, ses2->ssl_listen_port()));
|
, ses2->ssl_listen_port()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ses1: connecting peer port: %d\n", int(ses2->listen_port()));
|
fprintf(stderr, "%s: ses1: connecting peer port: %d\n", time_now_string(), int(ses2->listen_port()));
|
||||||
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
|
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
|
||||||
, ses2->listen_port()));
|
, ses2->listen_port()));
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ bool udp_failed = false;
|
||||||
|
|
||||||
void stop_tracker()
|
void stop_tracker()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "stop_tracker()\n");
|
fprintf(stderr, "%s: stop_tracker()\n", time_now_string());
|
||||||
if (tracker_server && tracker_ios)
|
if (tracker_server && tracker_ios)
|
||||||
{
|
{
|
||||||
tracker_ios->stop();
|
tracker_ios->stop();
|
||||||
|
@ -605,7 +605,7 @@ void stop_tracker()
|
||||||
delete tracker_ios;
|
delete tracker_ios;
|
||||||
tracker_ios = 0;
|
tracker_ios = 0;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "done\n");
|
fprintf(stderr, "%s: stop_tracker() done\n", time_now_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_tracker_thread(int* port);
|
void udp_tracker_thread(int* port);
|
||||||
|
@ -650,7 +650,7 @@ void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoin
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "UDP message %d bytes\n", int(bytes_transferred));
|
fprintf(stderr, "%s: UDP message %d bytes\n", time_now_string(), int(bytes_transferred));
|
||||||
|
|
||||||
char* ptr = buffer;
|
char* ptr = buffer;
|
||||||
detail::read_uint64(ptr);
|
detail::read_uint64(ptr);
|
||||||
|
@ -663,7 +663,7 @@ void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoin
|
||||||
{
|
{
|
||||||
case 0: // connect
|
case 0: // connect
|
||||||
|
|
||||||
fprintf(stderr, "UDP connect\n");
|
fprintf(stderr, "%s: UDP connect\n", time_now_string());
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
detail::write_uint32(0, ptr); // action = connect
|
detail::write_uint32(0, ptr); // action = connect
|
||||||
detail::write_uint32(transaction_id, ptr); // transaction_id
|
detail::write_uint32(transaction_id, ptr); // transaction_id
|
||||||
|
@ -673,7 +673,7 @@ void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoin
|
||||||
|
|
||||||
case 1: // announce
|
case 1: // announce
|
||||||
|
|
||||||
fprintf(stderr, "UDP announce\n");
|
fprintf(stderr, "%s: UDP announce\n", time_now_string());
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
detail::write_uint32(1, ptr); // action = announce
|
detail::write_uint32(1, ptr); // action = announce
|
||||||
detail::write_uint32(transaction_id, ptr); // transaction_id
|
detail::write_uint32(transaction_id, ptr); // transaction_id
|
||||||
|
@ -686,10 +686,10 @@ void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoin
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// ignore scrapes
|
// ignore scrapes
|
||||||
fprintf(stderr, "UDP scrape\n");
|
fprintf(stderr, "%s: UDP scrape\n", time_now_string());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "UDP unknown message: %d\n", action);
|
fprintf(stderr, "%s: UDP unknown message: %d\n", time_now_string(), action);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ void udp_tracker_thread(int* port)
|
||||||
}
|
}
|
||||||
*port = acceptor.local_endpoint().port();
|
*port = acceptor.local_endpoint().port();
|
||||||
|
|
||||||
fprintf(stderr, "UDP tracker initialized on port %d\n", *port);
|
fprintf(stderr, "%s: UDP tracker initialized on port %d\n", time_now_string(), *port);
|
||||||
|
|
||||||
{
|
{
|
||||||
libtorrent::mutex::scoped_lock l(tracker_lock);
|
libtorrent::mutex::scoped_lock l(tracker_lock);
|
||||||
|
@ -740,7 +740,7 @@ void udp_tracker_thread(int* port)
|
||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error receiving on UDP socket: %s\n", ec.message().c_str());
|
fprintf(stderr, "%s: Error receiving on UDP socket: %s\n", time_now_string(), ec.message().c_str());
|
||||||
libtorrent::mutex::scoped_lock l(tracker_lock);
|
libtorrent::mutex::scoped_lock l(tracker_lock);
|
||||||
tracker_initialized.signal(l);
|
tracker_initialized.signal(l);
|
||||||
return;
|
return;
|
||||||
|
@ -764,16 +764,16 @@ static void terminate_web_thread()
|
||||||
|
|
||||||
void stop_web_server()
|
void stop_web_server()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "stop_web_server()\n");
|
fprintf(stderr, "%s: stop_web_server()\n", time_now_string());
|
||||||
if (web_server && web_ios)
|
if (web_server && web_ios)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "stopping web server thread\n");
|
fprintf(stderr, "%s: stopping web server thread\n", time_now_string());
|
||||||
web_ios->post(&terminate_web_thread);
|
web_ios->post(&terminate_web_thread);
|
||||||
web_server->join();
|
web_server->join();
|
||||||
web_server.reset();
|
web_server.reset();
|
||||||
}
|
}
|
||||||
remove("server.pem");
|
remove("server.pem");
|
||||||
fprintf(stderr, "done\n");
|
fprintf(stderr, "%s: stop_web_server() done\n", time_now_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
void web_server_thread(int* port, bool ssl, bool chunked);
|
void web_server_thread(int* port, bool ssl, bool chunked);
|
||||||
|
|
|
@ -139,7 +139,7 @@ void test_proxy(proxy_settings::proxy_type proxy_type, int flags)
|
||||||
h.connect_peer(tcp::endpoint(address_v4::from_string("127.0.0.1"), peer_port));
|
h.connect_peer(tcp::endpoint(address_v4::from_string("127.0.0.1"), peer_port));
|
||||||
|
|
||||||
rejected_trackers.clear();
|
rejected_trackers.clear();
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 15; ++i)
|
||||||
{
|
{
|
||||||
print_alerts(*s, "s", false, false, false, &alert_predicate);
|
print_alerts(*s, "s", false, false, false, &alert_predicate);
|
||||||
test_sleep(100);
|
test_sleep(100);
|
||||||
|
@ -172,9 +172,9 @@ void test_proxy(proxy_settings::proxy_type proxy_type, int flags)
|
||||||
if (flags & expect_http_reject)
|
if (flags & expect_http_reject)
|
||||||
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end(), http_tracker_url) != rejected_trackers.end());
|
TEST_CHECK(std::find(rejected_trackers.begin(), rejected_trackers.end(), http_tracker_url) != rejected_trackers.end());
|
||||||
|
|
||||||
fprintf(stderr, "destructing session\n");
|
fprintf(stderr, "%s: ~session\n", time_now_string());
|
||||||
delete s;
|
delete s;
|
||||||
fprintf(stderr, "done\n");
|
fprintf(stderr, "%s: ~session done\n", time_now_string());
|
||||||
|
|
||||||
stop_peer();
|
stop_peer();
|
||||||
stop_dht();
|
stop_dht();
|
||||||
|
|
Loading…
Reference in New Issue