aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-08-01 13:31:02 -0400
committerDeterminant <[email protected]>2018-08-01 13:31:02 -0400
commit56a5a5570055208b5b791d0e11a49cf43a4a332e (patch)
treedb5dff2b41ab72dd69a188943f551b3fb331c75c /src
parent207f82c78270ab7d3dbdd84c0b90aed1d5060b00 (diff)
...
Diffstat (limited to 'src')
-rw-r--r--src/hotstuff.cpp14
-rw-r--r--src/hotstuff_app.cpp8
-rw-r--r--src/hotstuff_client.cpp6
3 files changed, 14 insertions, 14 deletions
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();