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
3a2dee28
Commit
3a2dee28
authored
Oct 18, 2017
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
r35386: Add more errors to does_error_affect_main_socket
parent
fe899cb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
controller.cpp
src/brpc/controller.cpp
+2
-0
socket.cpp
src/brpc/socket.cpp
+2
-2
brpc_socket_unittest.cpp
test/brpc_socket_unittest.cpp
+2
-2
No files found.
src/brpc/controller.cpp
View file @
3a2dee28
...
...
@@ -652,6 +652,8 @@ void* Controller::RunEndRPC(void* arg) {
inline
bool
does_error_affect_main_socket
(
int
error_code
)
{
return
error_code
==
ECONNREFUSED
||
error_code
==
ENETUNREACH
||
error_code
==
EHOSTUNREACH
||
error_code
==
EINVAL
/*returned by connect "0.0.0.1"*/
;
}
...
...
src/brpc/socket.cpp
View file @
3a2dee28
...
...
@@ -1331,7 +1331,7 @@ void Socket::AfterAppConnected(int err, void* data) {
}
}
else
{
SocketUniquePtr
s
(
req
->
socket
);
s
->
SetFailed
(
err
,
"Fail to
make %s connected
: %s"
,
s
->
SetFailed
(
err
,
"Fail to
connect %s
: %s"
,
s
->
description
().
c_str
(),
berror
(
err
));
s
->
ReleaseAllFailedWriteRequests
(
req
);
}
...
...
@@ -1491,7 +1491,7 @@ int Socket::StartWrite(WriteRequest* req, const WriteOptions& opt) {
int
ret
=
ConnectIfNot
(
opt
.
abstime
,
req
);
if
(
ret
<
0
)
{
saved_errno
=
errno
;
SetFailed
(
errno
,
"Fail to
make %s connected
: %m"
,
description
().
c_str
());
SetFailed
(
errno
,
"Fail to
connect %s directly
: %m"
,
description
().
c_str
());
goto
FAIL_TO_WRITE
;
}
else
if
(
ret
==
1
)
{
// We are doing connection. Callback `KeepWriteIfConnected'
...
...
test/brpc_socket_unittest.cpp
View file @
3a2dee28
...
...
@@ -497,7 +497,7 @@ TEST_F(SocketTest, not_health_check_when_nref_hits_0) {
ASSERT_EQ
(
wait_id
.
value
,
data
.
id
.
value
);
ASSERT_EQ
(
ECONNREFUSED
,
data
.
error_code
);
ASSERT_TRUE
(
butil
::
StringPiece
(
data
.
error_text
).
starts_with
(
"Fail to
make
SocketId="
));
"Fail to
connect
SocketId="
));
#else
ASSERT_EQ
(
-
1
,
s
->
Write
(
&
src
));
ASSERT_EQ
(
ECONNREFUSED
,
errno
);
...
...
@@ -577,7 +577,7 @@ TEST_F(SocketTest, health_check) {
ASSERT_EQ
(
wait_id
.
value
,
data
.
id
.
value
);
ASSERT_EQ
(
ECONNREFUSED
,
data
.
error_code
);
ASSERT_TRUE
(
butil
::
StringPiece
(
data
.
error_text
).
starts_with
(
"Fail to
make
SocketId="
));
"Fail to
connect
SocketId="
));
if
(
use_my_message
)
{
ASSERT_TRUE
(
appended_msg
);
}
...
...
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