diff options
author | Jonathan Ma <jonathan.ma@mongodb.com> | 2019-01-15 10:08:25 -0500 |
---|---|---|
committer | Jonathan Ma <jonathan.ma@mongodb.com> | 2019-01-16 08:57:08 -0500 |
commit | 692be593357338e488623dbd2d4ecabff4ab323c (patch) | |
tree | 17eba726b459f0d591caa397040d706fe92c7f5f | |
parent | 2e4123624ee678d1ac227eb4e843f54eb32006d3 (diff) | |
download | mongo-692be593357338e488623dbd2d4ecabff4ab323c.tar.gz |
SERVER-37389 Give different messages for different connection failure reasons
-rw-r--r-- | src/mongo/transport/asio_utils.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mongo/transport/asio_utils.h b/src/mongo/transport/asio_utils.h index 2a8a2310a6b..dccb0803392 100644 --- a/src/mongo/transport/asio_utils.h +++ b/src/mongo/transport/asio_utils.h @@ -74,9 +74,12 @@ inline Status errorCodeToStatus(const std::error_code& ec) { if (ec == asio::error::try_again || ec == asio::error::would_block) { #endif return {ErrorCodes::NetworkTimeout, "Socket operation timed out"}; - } else if (ec == asio::error::eof || ec == asio::error::connection_reset || - ec == asio::error::network_reset) { - return {ErrorCodes::HostUnreachable, "Connection was closed"}; + } else if (ec == asio::error::eof) { + return {ErrorCodes::HostUnreachable, "Connection closed by peer"}; + } else if (ec == asio::error::connection_reset) { + return {ErrorCodes::HostUnreachable, "Connection reset by peer"}; + } else if (ec == asio::error::network_reset) { + return {ErrorCodes::HostUnreachable, "Connection reset by network"}; } // If the ec.category() is a mongoErrorCategory() then this error was propogated from |