Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code style #82

Merged
merged 1 commit into from
Mar 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/sofa/pbrpc/rpc_byte_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,14 @@ class RpcByteStream : public sofa::pbrpc::enable_shared_from_this<RpcByteStream>
}
}

void on_connect_timeout(const boost::system::error_code& error) {
if (_status != STATUS_CONNECTING) {
void on_connect_timeout(const boost::system::error_code& error)
{
if (_status != STATUS_CONNECTING)
{
return;
}
if (error == boost::asio::error::operation_aborted) {
if (error == boost::asio::error::operation_aborted)
{
return;
}
close("connect timeout");
Expand All @@ -106,7 +109,8 @@ class RpcByteStream : public sofa::pbrpc::enable_shared_from_this<RpcByteStream>
_status = STATUS_CONNECTING;
_socket.async_connect(_remote_endpoint,
boost::bind(&RpcByteStream::on_connect, shared_from_this(), _1));
if (_connect_timeout > 0) {
if (_connect_timeout > 0)
{
_timer.expires_from_now(boost::posix_time::milliseconds(_connect_timeout));
_timer.async_wait(boost::bind(&RpcByteStream::on_connect_timeout, shared_from_this(), _1));
}
Expand Down Expand Up @@ -242,11 +246,13 @@ class RpcByteStream : public sofa::pbrpc::enable_shared_from_this<RpcByteStream>
return _last_rw_ticks;
}

void set_connect_timeout(int64 timeout) {
void set_connect_timeout(int64 timeout)
{
_connect_timeout = timeout;
}

int64 connect_timeout() {
int64 connect_timeout()
{
return _connect_timeout;
}

Expand Down Expand Up @@ -303,7 +309,8 @@ class RpcByteStream : public sofa::pbrpc::enable_shared_from_this<RpcByteStream>
SOFA_PBRPC_FUNCTION_TRACE;

//Maybe already timeout
if (_status != STATUS_CONNECTING) {
if (_status != STATUS_CONNECTING)
{
return;
}

Expand Down