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
c8160cf7
Commit
c8160cf7
authored
Sep 09, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delay HC to avoid HC-timing issues in UT
parent
79d0f866
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
+12
-6
controller.cpp
src/brpc/controller.cpp
+2
-2
selective_channel.cpp
src/brpc/selective_channel.cpp
+5
-3
socket.cpp
src/brpc/socket.cpp
+5
-1
No files found.
src/brpc/controller.cpp
View file @
c8160cf7
...
...
@@ -969,9 +969,9 @@ 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
())
{
SetFailed
(
EHOSTDOWN
,
"Not connected to %s yet, server_id=%"
PRIu64
,
endpoint2str
(
_remote_side
).
c_str
(),
_single_server_id
);
tmp_sock
.
reset
();
// Release ref ASAP
SetFailed
(
EHOSTDOWN
,
"Not connected to %s yet"
,
endpoint2str
(
_remote_side
).
c_str
());
return
HandleSendFailed
();
}
_current_call
.
peer_id
=
_single_server_id
;
...
...
src/brpc/selective_channel.cpp
View file @
c8160cf7
...
...
@@ -48,13 +48,15 @@ public:
int
CheckHealth
(
Socket
*
ptr
)
{
if
(
ptr
->
health_check_count
()
==
0
)
{
LOG
(
INFO
)
<<
"Checking "
<<
*
chan
;
LOG
(
INFO
)
<<
"Checking "
<<
*
chan
<<
" chan=0x"
<<
(
void
*
)
chan
<<
" Fake"
<<
*
ptr
;
}
return
chan
->
CheckHealth
();
}
void
AfterRevived
(
Socket
*
)
{
LOG
(
INFO
)
<<
"Revived "
<<
*
chan
;
void
AfterRevived
(
Socket
*
ptr
)
{
LOG
(
INFO
)
<<
"Revived "
<<
*
chan
<<
" chan=0x"
<<
(
void
*
)
chan
<<
" Fake"
<<
*
ptr
;
}
};
...
...
src/brpc/socket.cpp
View file @
c8160cf7
...
...
@@ -833,10 +833,12 @@ int Socket::SetFailed(int error_code, const char* error_fmt, ...) {
// FIXME(gejun): the initial delay should be related to uncommited
// CircuitBreaker and shorter for occasional errors and longer for
// frequent errors.
// NOTE: the delay should be positive right now to avoid HC timing
// issues in UT.
if
(
_health_check_interval_s
>
0
)
{
PeriodicTaskManager
::
StartTaskAt
(
new
HealthCheckTask
(
id
()),
butil
::
milliseconds_from_now
(
0
)
/*FIXME*/
);
butil
::
milliseconds_from_now
(
100
/*NOTE*/
)
);
}
// Wake up all threads waiting on EPOLLOUT when closing fd
_epollout_butex
->
fetch_add
(
1
,
butil
::
memory_order_relaxed
);
...
...
@@ -2613,6 +2615,7 @@ std::string Socket::description() const {
if
(
local_port
>
0
)
{
butil
::
string_appendf
(
&
result
,
"@%d"
,
local_port
);
}
butil
::
string_appendf
(
&
result
,
" (0x%p)"
,
this
);
return
result
;
}
...
...
@@ -2641,6 +2644,7 @@ ostream& operator<<(ostream& os, const brpc::Socket& sock) {
if
(
local_port
>
0
)
{
os
<<
'@'
<<
local_port
;
}
os
<<
" (0x"
<<
(
void
*
)
&
sock
<<
')'
;
return
os
;
}
}
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