Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
5098d3d4
Commit
5098d3d4
authored
Jul 24, 2018
by
TousakaRin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In ScopedMethodStatus, use _controller->server() instead of _server.
parent
e9c0b2c0
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
8 additions
and
22 deletions
+8
-22
method_status.cpp
src/brpc/details/method_status.cpp
+1
-1
method_status.h
src/brpc/details/method_status.h
+0
-3
baidu_rpc_protocol.cpp
src/brpc/policy/baidu_rpc_protocol.cpp
+1
-2
http_rpc_protocol.cpp
src/brpc/policy/http_rpc_protocol.cpp
+1
-2
hulu_pbrpc_protocol.cpp
src/brpc/policy/hulu_pbrpc_protocol.cpp
+1
-2
mongo_protocol.cpp
src/brpc/policy/mongo_protocol.cpp
+1
-2
nshead_protocol.cpp
src/brpc/policy/nshead_protocol.cpp
+1
-2
sofa_pbrpc_protocol.cpp
src/brpc/policy/sofa_pbrpc_protocol.cpp
+1
-2
thrift_protocol.cpp
src/brpc/policy/thrift_protocol.cpp
+1
-6
No files found.
src/brpc/details/method_status.cpp
View file @
5098d3d4
...
...
@@ -132,7 +132,7 @@ ScopedMethodStatus::~ScopedMethodStatus() {
_status
->
OnResponded
(
_c
->
ErrorCode
(),
butil
::
cpuwide_time_us
()
-
_start_parse_us
);
_status
=
NULL
;
}
ServerPrivateAccessor
(
_
server
).
RemoveConcurrency
(
_c
);
ServerPrivateAccessor
(
_
c
->
server
()
).
RemoveConcurrency
(
_c
);
}
}
// namespace brpc
src/brpc/details/method_status.h
View file @
5098d3d4
...
...
@@ -103,11 +103,9 @@ friend class ScopedMethodStatus;
class
ScopedMethodStatus
{
public
:
ScopedMethodStatus
(
MethodStatus
*
status
,
const
Server
*
server
,
Controller
*
c
,
int64_t
start_parse_us
)
:
_status
(
status
)
,
_server
(
server
)
,
_c
(
c
)
,
_start_parse_us
(
start_parse_us
)
{}
~
ScopedMethodStatus
();
...
...
@@ -115,7 +113,6 @@ public:
private
:
DISALLOW_COPY_AND_ASSIGN
(
ScopedMethodStatus
);
MethodStatus
*
_status
;
const
Server
*
_server
;
Controller
*
_c
;
uint64_t
_start_parse_us
;
};
...
...
src/brpc/policy/baidu_rpc_protocol.cpp
View file @
5098d3d4
...
...
@@ -147,8 +147,7 @@ void SendRpcResponse(int64_t correlation_id,
}
Socket
*
sock
=
accessor
.
get_sending_socket
();
std
::
unique_ptr
<
Controller
,
LogErrorTextAndDelete
>
recycle_cntl
(
cntl
);
ScopedMethodStatus
method_status
(
method_status_raw
,
server
,
cntl
,
received_us
);
ScopedMethodStatus
method_status
(
method_status_raw
,
cntl
,
received_us
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_req
(
req
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_res
(
res
);
...
...
src/brpc/policy/http_rpc_protocol.cpp
View file @
5098d3d4
...
...
@@ -558,8 +558,7 @@ static void SendHttpResponse(Controller *cntl,
span
->
set_start_send_us
(
butil
::
cpuwide_time_us
());
}
std
::
unique_ptr
<
Controller
,
LogErrorTextAndDelete
>
recycle_cntl
(
cntl
);
ScopedMethodStatus
method_status
(
method_status_raw
,
server
,
cntl
,
received_us
);
ScopedMethodStatus
method_status
(
method_status_raw
,
cntl
,
received_us
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_req
(
req
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_res
(
res
);
Socket
*
socket
=
accessor
.
get_sending_socket
();
...
...
src/brpc/policy/hulu_pbrpc_protocol.cpp
View file @
5098d3d4
...
...
@@ -233,8 +233,7 @@ static void SendHuluResponse(int64_t correlation_id,
}
Socket
*
sock
=
accessor
.
get_sending_socket
();
std
::
unique_ptr
<
HuluController
,
LogErrorTextAndDelete
>
recycle_cntl
(
cntl
);
ScopedMethodStatus
method_status
(
method_status_raw
,
server
,
cntl
,
received_us
);
ScopedMethodStatus
method_status
(
method_status_raw
,
cntl
,
received_us
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_req
(
req
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_res
(
res
);
...
...
src/brpc/policy/mongo_protocol.cpp
View file @
5098d3d4
...
...
@@ -60,8 +60,7 @@ SendMongoResponse::~SendMongoResponse() {
void
SendMongoResponse
::
Run
()
{
std
::
unique_ptr
<
SendMongoResponse
>
delete_self
(
this
);
ScopedMethodStatus
method_status
(
status
,
server
,
&
cntl
,
received_us
);
ScopedMethodStatus
method_status
(
status
,
&
cntl
,
received_us
);
Socket
*
socket
=
ControllerPrivateAccessor
(
&
cntl
).
get_sending_socket
();
if
(
cntl
.
IsCloseConnection
())
{
...
...
src/brpc/policy/nshead_protocol.cpp
View file @
5098d3d4
...
...
@@ -72,8 +72,7 @@ void NsheadClosure::Run() {
}
Socket
*
sock
=
accessor
.
get_sending_socket
();
ScopedMethodStatus
method_status
(
_server
->
options
().
nshead_service
->
_status
,
_server
,
&
_controller
,
_received_us
);
&
_controller
,
_received_us
);
if
(
!
method_status
)
{
// Judge errors belongings.
// may not be accurate, but it does not matter too much.
...
...
src/brpc/policy/sofa_pbrpc_protocol.cpp
View file @
5098d3d4
...
...
@@ -217,8 +217,7 @@ static void SendSofaResponse(int64_t correlation_id,
}
Socket
*
sock
=
accessor
.
get_sending_socket
();
std
::
unique_ptr
<
Controller
,
LogErrorTextAndDelete
>
recycle_cntl
(
cntl
);
ScopedMethodStatus
method_status
(
method_status_raw
,
server
,
cntl
,
received_us
);
ScopedMethodStatus
method_status
(
method_status_raw
,
cntl
,
received_us
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_req
(
req
);
std
::
unique_ptr
<
const
google
::
protobuf
::
Message
>
recycle_res
(
res
);
...
...
src/brpc/policy/thrift_protocol.cpp
View file @
5098d3d4
...
...
@@ -225,7 +225,6 @@ void ThriftClosure::DoRun() {
// Recycle itself after `Run'
std
::
unique_ptr
<
ThriftClosure
>
recycle_ctx
(
this
);
const
Server
*
server
=
_controller
.
server
();
ScopedRemoveConcurrency
remove_concurrency_dummy
(
server
,
&
_controller
);
ControllerPrivateAccessor
accessor
(
&
_controller
);
Span
*
span
=
accessor
.
span
();
...
...
@@ -236,7 +235,7 @@ void ThriftClosure::DoRun() {
ScopedMethodStatus
method_status
(
server
->
options
().
thrift_service
?
server
->
options
().
thrift_service
->
_status
:
NULL
,
_server
,
&
_controller
,
cpuwide_start_us
()
);
&
_controller
,
_received_us
);
if
(
!
method_status
)
{
// Judge errors belongings.
// may not be accurate, but it does not matter too much.
...
...
@@ -350,10 +349,6 @@ void ThriftClosure::DoRun() {
// TODO: this is not sent
span
->
set_sent_us
(
butil
::
cpuwide_time_us
());
}
if
(
method_status
)
{
method_status
.
release
()
->
OnResponded
(
!
_controller
.
Failed
(),
butil
::
cpuwide_time_us
()
-
_received_us
);
}
}
ParseResult
ParseThriftMessage
(
butil
::
IOBuf
*
source
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment