diff options
author | Determinant <[email protected]> | 2019-03-27 15:06:29 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-03-27 15:06:29 -0400 |
commit | 37f7812a240e419c9aaf39a6069d113cfb45be0b (patch) | |
tree | 04d3e71db4be531d602eca66ee8bd3673cd8aee8 | |
parent | be0caa593b9ff05e1ef138abfd17995d4a5eebfc (diff) |
add options
-rw-r--r-- | include/hotstuff/hotstuff.h | 6 | ||||
m--------- | salticidae | 0 | ||||
-rw-r--r-- | src/hotstuff.cpp | 4 | ||||
-rw-r--r-- | src/hotstuff_app.cpp | 39 |
4 files changed, 30 insertions, 19 deletions
diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h index c4b87cf..f7acccc 100644 --- a/include/hotstuff/hotstuff.h +++ b/include/hotstuff/hotstuff.h @@ -204,7 +204,7 @@ class HotStuffBase: public HotStuffCore { pacemaker_bt pmaker, EventContext ec, size_t nworker, - const Net::Config &config); + const Net::Config &netconfig); ~HotStuffBase(); @@ -269,7 +269,7 @@ class HotStuff: public HotStuffBase { pacemaker_bt pmaker, EventContext ec = EventContext(), size_t nworker = 4, - const Net::Config &config = Net::Config()): + const Net::Config &netconfig = Net::Config()): HotStuffBase(blk_size, rid, new PrivKeyType(raw_privkey), @@ -277,7 +277,7 @@ class HotStuff: public HotStuffBase { std::move(pmaker), ec, nworker, - config) {} + netconfig) {} void add_replica(ReplicaID idx, const NetAddr &addr, const bytearray_t &pubkey_raw) { DataStream s(pubkey_raw); diff --git a/salticidae b/salticidae -Subproject ea6ae75fccad52d116559f320d6f0069c1ad552 +Subproject c91fdee8e845a2eccbc680c2d88748b2ac95a40 diff --git a/src/hotstuff.cpp b/src/hotstuff.cpp index 557a81e..f174559 100644 --- a/src/hotstuff.cpp +++ b/src/hotstuff.cpp @@ -362,13 +362,13 @@ HotStuffBase::HotStuffBase(uint32_t blk_size, pacemaker_bt pmaker, EventContext ec, size_t nworker, - const Net::Config &config): + const Net::Config &netconfig): HotStuffCore(rid, std::move(priv_key)), listen_addr(listen_addr), blk_size(blk_size), ec(ec), vpool(ec, nworker), - pn(ec, config), + pn(ec, netconfig), pmaker(std::move(pmaker)), fetched(0), delivered(0), diff --git a/src/hotstuff_app.cpp b/src/hotstuff_app.cpp index dab0298..e9a97e3 100644 --- a/src/hotstuff_app.cpp +++ b/src/hotstuff_app.cpp @@ -121,7 +121,8 @@ class HotStuffApp: public HotStuff { hotstuff::pacemaker_bt pmaker, const EventContext &ec, size_t nworker, - const Net::Config &config); + const Net::Config &repnet_config, + const ClientNetwork<opcode_t>::Config &clinet_config); void start(); }; @@ -153,9 +154,11 @@ int main(int argc, char **argv) { auto opt_fixed_proposer = Config::OptValInt::create(1); auto opt_qc_timeout = Config::OptValDouble::create(0.5); auto opt_imp_timeout = Config::OptValDouble::create(11); - auto opt_nworker = Config::OptValInt::create(4); - auto opt_netnworker = Config::OptValInt::create(4); - auto opt_netburst = Config::OptValInt::create(100); + auto opt_nworker = Config::OptValInt::create(1); + auto opt_repnworker = Config::OptValInt::create(1); + auto opt_repburst = Config::OptValInt::create(100); + auto opt_clinworker = Config::OptValInt::create(8); + auto opt_cliburst = Config::OptValInt::create(1000); config.add_opt("block-size", opt_blk_size, Config::SET_VAL); config.add_opt("parent-limit", opt_parent_limit, Config::SET_VAL); @@ -169,8 +172,10 @@ int main(int argc, char **argv) { config.add_opt("qc-timeout", opt_qc_timeout, Config::SET_VAL, 't', "set QC timeout (for sticky)"); config.add_opt("imp-timeout", opt_imp_timeout, Config::SET_VAL, 'u', "set impeachment timeout (for sticky)"); config.add_opt("nworker", opt_nworker, Config::SET_VAL, 'n', "the number of threads for verification"); - config.add_opt("netnworker", opt_netnworker, Config::SET_VAL, 'm', "the number of threads for network"); - config.add_opt("netburst", opt_netburst, Config::SET_VAL, 'm', "salticidae burst rate"); + config.add_opt("repnworker", opt_repnworker, Config::SET_VAL, 'm', "the number of threads for replica network"); + config.add_opt("repburst", opt_repburst, Config::SET_VAL, 'b', ""); + config.add_opt("clinworker", opt_clinworker, Config::SET_VAL, 'M', "the number of threads for client network"); + config.add_opt("cliburst", opt_cliburst, Config::SET_VAL, 'B', ""); config.add_opt("help", opt_help, Config::SWITCH_ON, 'h', "show this help info"); EventContext ec; @@ -216,10 +221,14 @@ int main(int argc, char **argv) { else pmaker = new hotstuff::PaceMakerDummyFixed(opt_fixed_proposer->get(), parent_limit); - HotStuffApp::Net::Config netconfig; - netconfig - .burst_size(opt_netburst->get()) - .nworker(opt_netnworker->get()); + HotStuffApp::Net::Config repnet_config; + ClientNetwork<opcode_t>::Config clinet_config; + repnet_config + .burst_size(opt_repburst->get()) + .nworker(opt_repnworker->get()); + clinet_config + .burst_size(opt_cliburst->get()) + .nworker(opt_clinworker->get()); papp = new HotStuffApp(opt_blk_size->get(), opt_stat_period->get(), opt_imp_timeout->get(), @@ -230,7 +239,8 @@ int main(int argc, char **argv) { std::move(pmaker), ec, opt_nworker->get(), - netconfig); + repnet_config, + clinet_config); for (size_t i = 0; i < replicas.size(); i++) { auto p = split_ip_port_cport(replicas[i].first); @@ -258,13 +268,14 @@ HotStuffApp::HotStuffApp(uint32_t blk_size, hotstuff::pacemaker_bt pmaker, const EventContext &ec, size_t nworker, - const Net::Config &config): + const Net::Config &repnet_config, + const ClientNetwork<opcode_t>::Config &clinet_config): HotStuff(blk_size, idx, raw_privkey, - plisten_addr, std::move(pmaker), ec, nworker, config), + plisten_addr, std::move(pmaker), ec, nworker, repnet_config), stat_period(stat_period), impeach_timeout(impeach_timeout), ec(ec), - cn(ec, ClientNetwork<opcode_t>::Config().burst_size(1)), + cn(ec, clinet_config), clisten_addr(clisten_addr) { /* register the handlers for msg from clients */ cn.reg_handler(salticidae::generic_bind(&HotStuffApp::client_request_cmd_handler, this, _1, _2)); |