-
Notifications
You must be signed in to change notification settings - Fork 1
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
net_plugin多线程整改(net_plugin部分) #17
Comments
channel(boost::signals2::signal) 以plugin A , plugin B通信举例
|
对于channel(signals2)中传递的指针或者指针引用的解决方案: 在net_plugin订阅的回调函数中,需要对指针指向的数据进行deepcopy,然后再将数据boost::asio::post到子线程,从而避免竞争条件. |
测试中遇到的问题
info 2019-09-17T03:56:55.876 thread-1 net_plugin.cpp:1760 verify_catchup ] got a catch_up notice while in in sync, fork head num = 1974 target LIB = 1973 next_expected = 1974
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >'
what(): close: Bad file descriptor
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当前net_plugin和其它plugin都是在同一个线程中运行的,现在希望能把net_plugin独立拿出来做成单独的net_plugin线程。
经分析,主要难度在于修改net_plugin与其它plugin之间的通信,下面是主要的一些通信方式:
net_plugin调用(通知)其它plugin的情况
发布点: net_plugin中
pbft_incoming_prepare_channel.publish(std::make_shared<pbft_message_metadata<pbft_prepare>>(std::move(pmm)));
订阅点: chain_plugin中
my->pbft_incoming_prepare_channel.subscribe
发布点: net_plugin中
pbft_incoming_commit_channel.publish(std::make_shared<pbft_message_metadata<pbft_commit>>(std::move(pmm)));
订阅点: chain_plugin
my->pbft_incoming_commit_channel.subscribe
发布点: net_plugin
pbft_incoming_view_change_channel.publish(std::make_shared<pbft_message_metadata<pbft_view_change>>(std::move(pmm)));
订阅点: chain_plugin
my->pbft_incoming_view_change_channel.subscribe
发布点: net_plugin
pbft_incoming_new_view_channel.publish(std::make_shared<pbft_message_metadata<pbft_new_view>>(std::move(pmm)));
订阅点: chain_plugin
my->pbft_incoming_new_view_channel.subscribe
发布点: net_plugin
pbft_incoming_checkpoint_channel.publish(std::make_shared<pbft_message_metadata<pbft_checkpoint>>(std::move(pmm)));
订阅点: chain_plugin
my->pbft_incoming_checkpoint_channel.subscribe
无
无
其它plugin调用net_plugin的情况
无
无
INVOKE_R_R(net_mgr, connect, std::string), 201),
INVOKE_R_R(net_mgr, disconnect, std::string), 201),
INVOKE_R_R(net_mgr, status, std::string), 201),
INVOKE_R_V(net_mgr, connections), 201),
The text was updated successfully, but these errors were encountered: