Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash or hang when shutting down a websocket server #2204

Merged
merged 2 commits into from
Jun 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions tests/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ std::shared_ptr<graphene::app::application> start_application(fc::temp_directory
app1->startup_plugins();

app1->startup();
fc::usleep(fc::milliseconds(500));

return app1;
}
Expand Down Expand Up @@ -299,16 +298,6 @@ class client_connection

struct cli_fixture
{
class dummy
{
public:
~dummy()
{
// wait for everything to finish up
fc::usleep(fc::milliseconds(500));
}
};
dummy dmy;
int server_port_number;
fc::temp_directory app_dir;
std::shared_ptr<graphene::app::application> app1;
Expand Down Expand Up @@ -1001,17 +990,12 @@ BOOST_AUTO_TEST_CASE( cli_multisig_transaction )
}
}

// wait for everything to finish up
fc::usleep(fc::seconds(1));
} catch( fc::exception& e ) {
edump((e.to_detail_string()));
throw;
}
app1->shutdown();
app1.reset();
// Intentional delay after app1->shutdown
std::cout << "cli_multisig_transaction conclusion: Intentional delay" << std::endl;
fc::usleep(fc::seconds(1));
}

graphene::wallet::plain_keys decrypt_keys( const std::string& password, const vector<char>& cipher_keys )
Expand Down Expand Up @@ -1041,6 +1025,7 @@ BOOST_AUTO_TEST_CASE( saving_keys_wallet_test ) {
BOOST_CHECK( pk.keys.size() == 1 ); // nathan key

BOOST_CHECK( generate_block( cli.app1 ) );
// Intentional delay
fc::usleep( fc::seconds(1) );

wallet = fc::json::from_file( path ).as<graphene::wallet::wallet_data>( 2 * GRAPHENE_MAX_NESTED_OBJECTS );
Expand Down Expand Up @@ -1225,17 +1210,12 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc )
BOOST_CHECK(generate_block(app1));
}

// wait for everything to finish up
fc::usleep(fc::seconds(1));
} catch( fc::exception& e ) {
edump((e.to_detail_string()));
throw;
}
app1->shutdown();
app1.reset();
// Intentional delay after app1->shutdown
std::cout << "cli_create_htlc conclusion: Intentional delay" << std::endl;
fc::usleep(fc::seconds(1));
}

static string encapsulate( const graphene::wallet::signed_message& msg )
Expand Down Expand Up @@ -1807,15 +1787,10 @@ BOOST_AUTO_TEST_CASE( cli_create_htlc_bsip64 )
}
con.wallet_api_ptr->unlock("supersecret");

// wait for everything to finish up
fc::usleep(fc::seconds(1));
} catch( fc::exception& e ) {
edump((e.to_detail_string()));
throw;
}
app1->shutdown();
app1.reset();
// Intentional delay after app1->shutdown
std::cout << "cli_create_htlc conclusion: Intentional delay" << std::endl;
fc::usleep(fc::seconds(1));
}