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
77566c87
Commit
77566c87
authored
Mar 24, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
health_check_using_rpc: fix leak & change the time of setting _health_check_using_rpc
parent
95b8f54f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
controller.cpp
src/brpc/controller.cpp
+1
-1
controller.h
src/brpc/controller.h
+1
-1
socket.cpp
src/brpc/socket.cpp
+6
-4
No files found.
src/brpc/controller.cpp
View file @
77566c87
...
...
@@ -987,7 +987,7 @@ void Controller::IssueRPC(int64_t start_realtime_us) {
// of the backup call.
const
int
rc
=
Socket
::
Address
(
_single_server_id
,
&
tmp_sock
);
if
(
rc
!=
0
||
tmp_sock
->
IsLogOff
()
||
(
!
has_flag
(
FLAGS_HEALTH_CHECK_CALL
)
&&
tmp_sock
->
IsHealthCheckingUsingRPC
()))
{
(
!
is_health_check_call
(
)
&&
tmp_sock
->
IsHealthCheckingUsingRPC
()))
{
SetFailed
(
EHOSTDOWN
,
"Not connected to %s yet, server_id=%"
PRIu64
,
endpoint2str
(
_remote_side
).
c_str
(),
_single_server_id
);
tmp_sock
.
reset
();
// Release ref ASAP
...
...
src/brpc/controller.h
View file @
77566c87
...
...
@@ -589,7 +589,7 @@ private:
// Tell RPC that this particular call is used to do health check.
void
set_health_check_call
(
bool
f
)
{
set_flag
(
FLAGS_HEALTH_CHECK_CALL
,
f
);
}
bool
ha
s_health_check_call
()
const
{
return
has_flag
(
FLAGS_HEALTH_CHECK_CALL
);
}
bool
i
s_health_check_call
()
const
{
return
has_flag
(
FLAGS_HEALTH_CHECK_CALL
);
}
public
:
CallId
current_id
()
const
{
...
...
src/brpc/socket.cpp
View file @
77566c87
...
...
@@ -758,7 +758,11 @@ int Socket::WaitAndReset(int32_t expected_nref) {
_pipeline_q
->
clear
();
}
}
_health_checking_using_rpc
.
store
(
false
,
butil
::
memory_order_relaxed
);
if
(
!
FLAGS_health_check_path
.
empty
())
{
_health_checking_using_rpc
.
store
(
true
,
butil
::
memory_order_relaxed
);
}
else
{
_health_checking_using_rpc
.
store
(
false
,
butil
::
memory_order_relaxed
);
}
return
0
;
}
...
...
@@ -793,9 +797,6 @@ void Socket::Revive() {
}
else
{
LOG
(
INFO
)
<<
"Revived "
<<
*
this
;
}
if
(
!
FLAGS_health_check_path
.
empty
())
{
_health_checking_using_rpc
.
store
(
true
,
butil
::
memory_order_relaxed
);
}
return
;
}
}
...
...
@@ -1070,6 +1071,7 @@ public:
if
(
done
->
channel
.
Init
(
id
,
&
options
)
!=
0
)
{
LOG
(
WARNING
)
<<
"Fail to init health check channel to SocketId="
<<
id
;
ptr
->
ResetHealthCheckingUsingRPC
();
delete
done
;
return
;
}
done
->
cntl
.
http_request
().
uri
()
=
FLAGS_health_check_path
;
...
...
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