From 26663509789b60390c02a977cd05dc3a96e57310 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Thu, 25 Feb 2016 03:24:16 -0500 Subject: [PATCH 1/3] Fix iteration logic in _handle_message_calls_in_progress shutdown loop to handle concurrent modification #598 --- libraries/net/node.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libraries/net/node.cpp b/libraries/net/node.cpp index db2369a0..6fb212c7 100644 --- a/libraries/net/node.cpp +++ b/libraries/net/node.cpp @@ -3952,12 +3952,20 @@ namespace graphene { namespace net { namespace detail { } unsigned handle_message_call_count = 0; - for (fc::future& handle_message_call : _handle_message_calls_in_progress) + while( true ) { + auto it = _handle_message_calls_in_progress.begin(); + if( it == _handle_message_calls_in_progress.end() ) + break; + if( it->ready() || it->error() || it->canceled() ) + { + _handle_message_calls_in_progress.erase( it ); + continue; + } ++handle_message_call_count; try { - handle_message_call.cancel_and_wait("node_impl::close()"); + it->cancel_and_wait("node_impl::close()"); dlog("handle_message call #${count} task terminated", ("count", handle_message_call_count)); } catch ( const fc::canceled_exception& ) @@ -3973,7 +3981,6 @@ namespace graphene { namespace net { namespace detail { wlog("Exception thrown while terminating handle_message call #${count} task, ignoring",("count", handle_message_call_count)); } } - _handle_message_calls_in_progress.clear(); try { From e8aa505e823435f5c1ac8eed8238445b5febddd8 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Thu, 25 Feb 2016 11:34:44 -0500 Subject: [PATCH 2/3] Bump fc --- libraries/fc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/fc b/libraries/fc index 8eec508b..83b4de06 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 8eec508b8cd418f0719a58f10a11d7850e87b992 +Subproject commit 83b4de067a6c99704a6d21d6dfc8b1e838ddcaf7 From 92cfb96c618e1c051dd7a7224e5392d56c496c06 Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 26 Feb 2016 13:35:19 -0500 Subject: [PATCH 3/3] Test serialization of extensions #599 --- tests/tests/serialization_tests.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/tests/serialization_tests.cpp b/tests/tests/serialization_tests.cpp index 84fced8e..fb87c4c4 100644 --- a/tests/tests/serialization_tests.cpp +++ b/tests/tests/serialization_tests.cpp @@ -122,4 +122,30 @@ BOOST_AUTO_TEST_CASE( extended_public_key_type_test ) } } +BOOST_AUTO_TEST_CASE( extension_serialization_test ) +{ + try + { + buyback_account_options bbo; + bbo.asset_to_buy = asset_id_type(1000); + bbo.asset_to_buy_issuer = account_id_type(2000); + bbo.markets.emplace( asset_id_type() ); + bbo.markets.emplace( asset_id_type(777) ); + account_create_operation create_op = make_account( "rex" ); + create_op.registrar = account_id_type(1234); + create_op.extensions.value.buyback_options = bbo; + + auto packed = fc::raw::pack( create_op ); + account_create_operation unpacked = fc::raw::unpack(packed); + + ilog( "original: ${x}", ("x", create_op) ); + ilog( "unpacked: ${x}", ("x", unpacked) ); + } + catch ( const fc::exception& e ) + { + edump((e.to_detail_string())); + throw; + } +} + BOOST_AUTO_TEST_SUITE_END()