Skip to content

Commit

Permalink
add sleep when reconnect the peer;
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Apr 23, 2019
1 parent d0c11da commit 82fb3fb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/rpc_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ namespace rest_rpc {
socket_.async_connect({ addr, port_ }, [this](const boost::system::error_code& ec) {
if (ec) {
std::cout << ec.message() << std::endl;
socket_.close();
has_connected_ = false;
std::this_thread::sleep_for(std::chrono::seconds(1));
if (reconnect_cnt_ == 0) {
return;
}
Expand Down

0 comments on commit 82fb3fb

Please sign in to comment.