Commit 3a2dee28 authored by gejun's avatar gejun

r35386: Add more errors to does_error_affect_main_socket

parent fe899cb0
......@@ -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"*/;
}
......
......@@ -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'
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment