added test to demonstrate issue
This commit is contained in:
parent
d5024e85f9
commit
f84de73e66
4 changed files with 22 additions and 2 deletions
|
|
@ -99,6 +99,7 @@ namespace fc {
|
|||
|
||||
default_io_service_scope()
|
||||
{
|
||||
cleanup_complete = false;
|
||||
io = new boost::asio::io_service();
|
||||
the_work = new boost::asio::io_service::work(*io);
|
||||
for( int i = 0; i < 8; ++i ) {
|
||||
|
|
@ -146,10 +147,16 @@ namespace fc {
|
|||
for( auto asio_thread : asio_threads ) {
|
||||
delete asio_thread;
|
||||
}
|
||||
cleanup_complete = true;
|
||||
}
|
||||
|
||||
~default_io_service_scope()
|
||||
{}
|
||||
{
|
||||
if (!cleanup_complete)
|
||||
cleanup();
|
||||
}
|
||||
private:
|
||||
bool cleanup_complete;
|
||||
};
|
||||
|
||||
/// If cleanup is true, do not use the return value; it is a null reference
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ namespace fc {
|
|||
|
||||
tcp_socket::tcp_socket(){};
|
||||
|
||||
tcp_socket::~tcp_socket(){};
|
||||
tcp_socket::~tcp_socket() {}
|
||||
|
||||
void tcp_socket::flush() {}
|
||||
void tcp_socket::close() {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ add_executable( all_tests all_tests.cpp
|
|||
crypto/sha_tests.cpp
|
||||
io/json_tests.cpp
|
||||
io/stream_tests.cpp
|
||||
io/tcp_test.cpp
|
||||
network/http/websocket_test.cpp
|
||||
thread/task_cancel.cpp
|
||||
thread/thread_tests.cpp
|
||||
|
|
|
|||
12
tests/io/tcp_test.cpp
Normal file
12
tests/io/tcp_test.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <fc/network/tcp_socket.hpp>
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(tcp_tests)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(tcpconstructor_test)
|
||||
{
|
||||
fc::tcp_socket socket;
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
Loading…
Reference in a new issue