Skip to content

Commit

Permalink
remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos committed Aug 27, 2019
1 parent d4adf58 commit 0892629
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions include/rpc_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,6 @@ using boost::asio::ip::tcp;

namespace rest_rpc {
namespace rpc_service {
class retry_data : public std::enable_shared_from_this<retry_data> {
public:
retry_data(asio::io_service& ios, std::shared_ptr<std::string> data, size_t timeout) : timer_(ios), sp_data_(data),
timeout_(timeout) {
}

void cancel() {
if (timeout_ == 0) {
return;
}

boost::system::error_code ec;
timer_.cancel(ec);
}

bool has_timeout() const {
return has_timeout_;
}

std::shared_ptr<std::string> data() {
return sp_data_;
}

void start_timer() {
if (timeout_ == 0) {
return;
}

timer_.expires_from_now(std::chrono::milliseconds(timeout_));
auto self = this->shared_from_this();
timer_.async_wait([this, self](boost::system::error_code ec) {
if (ec) {
return;
}

has_timeout_ = true;
});
}
private:
boost::asio::steady_timer timer_;
std::shared_ptr<std::string> sp_data_;
size_t timeout_;
std::atomic_bool has_timeout_ = { false };
};

using rpc_conn = std::weak_ptr<connection>;
class rpc_server : private asio::noncopyable {
public:
Expand Down Expand Up @@ -116,10 +71,6 @@ namespace rest_rpc {
publish(key, "", std::move(data));
}

void publish_by_token(std::string token, std::string data) {
publish("", std::move(token), std::move(data));
}

void publish_by_token(const std::string& key, std::string token, std::string data) {
publish(key, std::move(token), std::move(data));
}
Expand Down

0 comments on commit 0892629

Please sign in to comment.