aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-07-02 01:17:15 -0400
committerDeterminant <[email protected]>2019-07-02 01:17:15 -0400
commit7e91de67703a3a3eb292d1a2422acb15a10d4b95 (patch)
tree59ba8a1f45127bd2908326dd7b0a60ced792b343 /src
parent9c1ff90092532a62141ae0e9d54461300b1d47cb (diff)
update net lib
Diffstat (limited to 'src')
-rw-r--r--src/hotstuff.cpp13
-rw-r--r--src/hotstuff_client.cpp2
2 files changed, 9 insertions, 6 deletions
diff --git a/src/hotstuff.cpp b/src/hotstuff.cpp
index 5e75cc3..54b80e4 100644
--- a/src/hotstuff.cpp
+++ b/src/hotstuff.cpp
@@ -192,7 +192,8 @@ promise_t HotStuffBase::async_deliver_blk(const uint256_t &blk_hash,
}
void HotStuffBase::propose_handler(MsgPropose &&msg, const Net::conn_t &conn) {
- const NetAddr &peer = conn->get_peer();
+ const NetAddr &peer = conn->get_peer_addr();
+ if (peer.is_null()) return;
msg.postponed_parse(this);
auto &prop = msg.proposal;
block_t blk = prop.blk;
@@ -205,7 +206,8 @@ void HotStuffBase::propose_handler(MsgPropose &&msg, const Net::conn_t &conn) {
}
void HotStuffBase::vote_handler(MsgVote &&msg, const Net::conn_t &conn) {
- const NetAddr &peer = conn->get_peer();
+ const NetAddr &peer = conn->get_peer_addr();
+ if (peer.is_null()) return;
msg.postponed_parse(this);
//auto &vote = msg.vote;
RcObj<Vote> v(new Vote(std::move(msg.vote)));
@@ -221,7 +223,8 @@ void HotStuffBase::vote_handler(MsgVote &&msg, const Net::conn_t &conn) {
}
void HotStuffBase::req_blk_handler(MsgReqBlock &&msg, const Net::conn_t &conn) {
- const NetAddr replica = conn->get_peer();
+ const NetAddr replica = conn->get_peer_addr();
+ if (replica.is_null()) return;
auto &blk_hashes = msg.blk_hashes;
std::vector<promise_t> pms;
for (const auto &h: blk_hashes)
@@ -341,8 +344,8 @@ HotStuffBase::HotStuffBase(uint32_t blk_size,
}
void HotStuffBase::do_broadcast_proposal(const Proposal &prop) {
- MsgPropose prop_msg(prop);
- pn.multicast_msg(prop_msg, peers);
+ //MsgPropose prop_msg(prop);
+ pn.multicast_msg(MsgPropose(prop), peers);
//for (const auto &replica: peers)
// pn.send_msg(prop_msg, replica);
}
diff --git a/src/hotstuff_client.cpp b/src/hotstuff_client.cpp
index 2c8b738..08f2a2e 100644
--- a/src/hotstuff_client.cpp
+++ b/src/hotstuff_client.cpp
@@ -68,7 +68,7 @@ Net mn(ec, Net::Config());
void connect_all() {
for (size_t i = 0; i < replicas.size(); i++)
- conns.insert(std::make_pair(i, mn.connect(replicas[i])));
+ conns.insert(std::make_pair(i, mn.connect_sync(replicas[i])));
}
bool try_send(bool check = true) {