Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
IndignantAngel committed Oct 12, 2016
1 parent a73fe76 commit 973f919
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions rest_rpc/client/detail/async_rpc_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace timax { namespace rpc
enum class status_t
{
stopped,
ready,
running,
};

Expand Down
10 changes: 6 additions & 4 deletions rest_rpc/client/detail/async_rpc_session_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace timax { namespace rpc
: rpc_mgr_(mgr)
, hb_timer_(ios)
, connection_(ios, endpoint)
, status_(status_t::running)
, status_(status_t::ready)
, is_write_in_progress_(false)
{
}
Expand Down Expand Up @@ -36,9 +36,10 @@ namespace timax { namespace rpc
template <typename CodecPolicy>
void rpc_session<CodecPolicy>::call(context_ptr& ctx)
{
if (status_t::stopped == status_.load())
auto status = status_.load();
if (status_t::stopped == status)
{
ctx->error(error_code::BADCONNECTION);
ctx->error(error_code::BADCONNECTION, "rpc session already stoppet");
return;
}

Expand All @@ -58,7 +59,7 @@ namespace timax { namespace rpc
}
}

if (empty)
if (empty && status_t::running == status)
{
auto self = this->shared_from_this();
rpc_mgr_.get_io_service().post([self, this]
Expand All @@ -74,6 +75,7 @@ namespace timax { namespace rpc
template <typename CodecPolicy>
void rpc_session<CodecPolicy>::start_rpc_service()
{
status_ = status_t::running;
recv_head();
setup_heartbeat_timer();
}
Expand Down

0 comments on commit 973f919

Please sign in to comment.