aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/hotstuff/hotstuff.h10
m---------salticidae0
-rw-r--r--src/hotstuff.cpp14
-rw-r--r--src/hotstuff_app.cpp8
-rw-r--r--src/hotstuff_client.cpp6
5 files changed, 19 insertions, 19 deletions
diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h
index 287cbac..41c83b4 100644
--- a/include/hotstuff/hotstuff.h
+++ b/include/hotstuff/hotstuff.h
@@ -116,7 +116,7 @@ class BlockDeliveryContext: public promise_t {
class HotStuffBase: public HotStuffCore {
using BlockFetchContext = FetchContext<ENT_TYPE_BLK>;
using CmdFetchContext = FetchContext<ENT_TYPE_CMD>;
- using conn_t = PeerNetwork<opcode_t>::conn_t;
+ using Conn = PeerNetwork<opcode_t>::Conn;
friend BlockFetchContext;
friend CmdFetchContext;
@@ -166,13 +166,13 @@ class HotStuffBase: public HotStuffCore {
void on_deliver_blk(const block_t &blk);
/** deliver consensus message: <propose> */
- inline void propose_handler(MsgPropose &&, conn_t);
+ inline void propose_handler(MsgPropose &&, Conn &);
/** deliver consensus message: <vote> */
- inline void vote_handler(MsgVote &&, conn_t);
+ inline void vote_handler(MsgVote &&, Conn &);
/** fetches full block data */
- inline void req_blk_handler(MsgReqBlock &&, conn_t);
+ inline void req_blk_handler(MsgReqBlock &&, Conn &);
/** receives a block */
- inline void resp_blk_handler(MsgRespBlock &&, conn_t);
+ inline void resp_blk_handler(MsgRespBlock &&, Conn &);
void do_broadcast_proposal(const Proposal &) override;
void do_vote(ReplicaID, const Vote &) override;
diff --git a/salticidae b/salticidae
-Subproject c9faab354fb314bacd9849503d8b4566a8c9ea6
+Subproject bc078abd9d5fcc420dfbcda06869a95aba39b1e
diff --git a/src/hotstuff.cpp b/src/hotstuff.cpp
index abd5116..9a56626 100644
--- a/src/hotstuff.cpp
+++ b/src/hotstuff.cpp
@@ -233,8 +233,8 @@ promise_t HotStuffBase::async_deliver_blk(const uint256_t &blk_hash,
return static_cast<promise_t &>(pm);
}
-void HotStuffBase::propose_handler(MsgPropose &&msg, conn_t conn) {
- const NetAddr &peer = conn->get_peer();
+void HotStuffBase::propose_handler(MsgPropose &&msg, Conn &conn) {
+ const NetAddr &peer = conn.get_peer();
msg.postponed_parse(this);
auto &prop = msg.proposal;
block_t blk = prop.blk;
@@ -247,8 +247,8 @@ void HotStuffBase::propose_handler(MsgPropose &&msg, conn_t conn) {
});
}
-void HotStuffBase::vote_handler(MsgVote &&msg, conn_t conn) {
- const NetAddr &peer = conn->get_peer();
+void HotStuffBase::vote_handler(MsgVote &&msg, Conn &conn) {
+ const NetAddr &peer = conn.get_peer();
msg.postponed_parse(this);
auto &vote = msg.vote;
promise::all(std::vector<promise_t>{
@@ -259,8 +259,8 @@ void HotStuffBase::vote_handler(MsgVote &&msg, conn_t conn) {
});
}
-void HotStuffBase::req_blk_handler(MsgReqBlock &&msg, conn_t conn) {
- const NetAddr replica = conn->get_peer();
+void HotStuffBase::req_blk_handler(MsgReqBlock &&msg, Conn &conn) {
+ const NetAddr replica = conn.get_peer();
auto &blk_hashes = msg.blk_hashes;
std::vector<promise_t> pms;
for (const auto &h: blk_hashes)
@@ -276,7 +276,7 @@ void HotStuffBase::req_blk_handler(MsgReqBlock &&msg, conn_t conn) {
});
}
-void HotStuffBase::resp_blk_handler(MsgRespBlock &&msg, conn_t) {
+void HotStuffBase::resp_blk_handler(MsgRespBlock &&msg, Conn &) {
msg.postponed_parse(this);
for (const auto &blk: msg.blks)
if (blk) on_fetch_blk(blk);
diff --git a/src/hotstuff_app.cpp b/src/hotstuff_app.cpp
index 8edec56..9a6e5fd 100644
--- a/src/hotstuff_app.cpp
+++ b/src/hotstuff_app.cpp
@@ -65,9 +65,9 @@ class HotStuffApp: public HotStuff {
/** Maximum number of parents. */
int32_t parent_limit;
- using conn_t = ClientNetwork<opcode_t>::conn_t;
+ using Conn = ClientNetwork<opcode_t>::Conn;
- void client_request_cmd_handler(MsgReqCmd &&, conn_t);
+ void client_request_cmd_handler(MsgReqCmd &&, Conn &);
void print_stat_cb(evutil_socket_t, short);
command_t parse_cmd(DataStream &s) override {
@@ -215,8 +215,8 @@ HotStuffApp::HotStuffApp(uint32_t blk_size,
cn.listen(clisten_addr);
}
-void HotStuffApp::client_request_cmd_handler(MsgReqCmd &&msg, conn_t conn) {
- const NetAddr addr = conn->get_addr();
+void HotStuffApp::client_request_cmd_handler(MsgReqCmd &&msg, Conn &conn) {
+ const NetAddr addr = conn.get_addr();
msg.postponed_parse(this);
auto cmd = msg.cmd;
std::vector<promise_t> pms;
diff --git a/src/hotstuff_client.cpp b/src/hotstuff_client.cpp
index e213e78..bee8abd 100644
--- a/src/hotstuff_client.cpp
+++ b/src/hotstuff_client.cpp
@@ -55,7 +55,7 @@ void try_send() {
while (waiting.size() < max_async_num && max_iter_num)
{
auto cmd = CommandDummy::make_cmd();
- mn.send_msg(MsgReqCmd(*cmd), conns.find(proposer)->second);
+ mn.send_msg(MsgReqCmd(*cmd), *conns.at(proposer));
HOTSTUFF_LOG_INFO("send new cmd %.10s",
get_hex(cmd->get_hash()).c_str());
waiting.insert(std::make_pair(
@@ -65,7 +65,7 @@ void try_send() {
}
}
-void client_resp_cmd_handler(MsgRespCmd &&msg, MsgNetwork<opcode_t>::conn_t) {
+void client_resp_cmd_handler(MsgRespCmd &&msg, MsgNetwork<opcode_t>::Conn &) {
auto &fin = msg.fin;
HOTSTUFF_LOG_DEBUG("got %s", std::string(msg.fin).c_str());
const uint256_t &cmd_hash = fin.cmd_hash;
@@ -78,7 +78,7 @@ void client_resp_cmd_handler(MsgRespCmd &&msg, MsgNetwork<opcode_t>::conn_t) {
if (fin.rid != it->second.rid)
{
mn.send_msg(MsgReqCmd(*(waiting.find(cmd_hash)->second.cmd)),
- conns.find(proposer)->second);
+ *conns.at(proposer));
HOTSTUFF_LOG_INFO("resend cmd %.10s",
get_hex(cmd_hash).c_str());
it->second.et.start();