return "negotiation failure";
case error::read_eof:
return "read eof";
- case error::connection_aborted:
- return "connection aborted";
- case error::connection_refused:
- return "connection refused";
- case error::connection_reset:
- return "connection reset";
case error::corrupted_message:
return "corrupted message";
- case error::invalid_argument:
- return "invalid argument";
- case error::address_in_use:
- return "address in use";
- case error::broken_pipe:
- return "broken pipe";
case error::protocol_aborted:
return "protocol aborted";
default:
return "unknown";
}
}
-
- // unfortunately, seastar throws connection errors with the system category,
- // rather than the generic category that would match their counterparts
- // in std::errc. we add our own errors for them, so we can match either
- std::error_condition default_error_condition(int ev) const noexcept override {
- switch (static_cast<error>(ev)) {
- case error::connection_aborted:
- return std::errc::connection_aborted;
- case error::connection_refused:
- return std::errc::connection_refused;
- case error::connection_reset:
- return std::errc::connection_reset;
- case error::invalid_argument:
- return std::errc::invalid_argument;
- case error::address_in_use:
- return std::errc::address_in_use;
- case error::broken_pipe:
- return std::errc::broken_pipe;
- default:
- return std::error_condition(ev, *this);
- }
- }
-
- bool equivalent(int code, const std::error_condition& cond) const noexcept override {
- if (error_category::equivalent(code, cond)) {
- return true;
- }
- switch (static_cast<error>(code)) {
- case error::connection_aborted:
- return cond == std::errc::connection_aborted
- || cond == std::error_condition(ECONNABORTED, std::system_category());
- case error::connection_refused:
- return cond == std::errc::connection_refused
- || cond == std::error_condition(ECONNREFUSED, std::system_category());
- case error::connection_reset:
- return cond == std::errc::connection_reset
- || cond == std::error_condition(ECONNRESET, std::system_category());
- case error::invalid_argument:
- return cond == std::errc::invalid_argument
- || cond == std::error_condition(EINVAL, std::system_category());
- case error::address_in_use:
- return cond == std::errc::address_in_use
- || cond == std::error_condition(EADDRINUSE, std::system_category());
- case error::broken_pipe:
- return cond == std::errc::broken_pipe
- || cond == std::error_condition(EPIPE, std::system_category());
- default:
- return false;
- }
- }
-
- bool equivalent(const std::error_code& code, int cond) const noexcept override {
- if (error_category::equivalent(code, cond)) {
- return true;
- }
- switch (static_cast<error>(cond)) {
- case error::connection_aborted:
- return code == std::errc::connection_aborted
- || code == std::error_code(ECONNABORTED, std::system_category());
- case error::connection_refused:
- return code == std::errc::connection_refused
- || code == std::error_code(ECONNREFUSED, std::system_category());
- case error::connection_reset:
- return code == std::errc::connection_reset
- || code == std::error_code(ECONNRESET, std::system_category());
- case error::invalid_argument:
- return code == std::errc::invalid_argument
- || code == std::error_code(EINVAL, std::system_category());
- case error::address_in_use:
- return code == std::errc::address_in_use
- || code == std::error_code(EADDRINUSE, std::system_category());
- case error::broken_pipe:
- return code == std::errc::broken_pipe
- || code == std::error_code(EPIPE, std::system_category());
- default:
- return false;
- }
- }
};
static category instance;
return instance;
socket = std::move(sock);
if (state == state_t::closing) {
return socket->close().then([] {
- throw std::system_error(make_error_code(error::connection_aborted));
+ throw std::system_error(make_error_code(error::protocol_aborted));
});
}
return seastar::now();
return handle_keepalive2_ack();
case CEPH_MSGR_TAG_CLOSE:
logger().info("{} got tag close", conn);
- throw std::system_error(make_error_code(error::connection_aborted));
+ throw std::system_error(make_error_code(error::protocol_aborted));
default:
logger().error("{} got unknown msgr tag {}",
conn, static_cast<int>(buf[0]));
return handle_tags()
.handle_exception_type([this] (const std::system_error& e) {
logger().warn("{} open fault: {}", conn, e);
- if (e.code() == error::connection_aborted ||
- e.code() == error::connection_reset) {
+ if (e.code() == error::protocol_aborted ||
+ e.code() == std::errc::connection_reset) {
return dispatcher.ms_handle_reset(
seastar::static_pointer_cast<SocketConnection>(conn.shared_from_this()))
.then([this] {
return socket_connect().discard_result().then([] {
ceph_abort_msg("connection is not refused");
}).handle_exception_type([] (const std::system_error& e) {
- if (e.code() != error::connection_refused) {
+ if (e.code() != std::errc::connection_refused) {
logger.error("test_refused() got unexpeted error {}", e);
ceph_abort();
} else {
}).finally([pss2] {
return pss2->destroy();
}).handle_exception_type([] (const std::system_error& e) {
- if (e.code() != error::address_in_use) {
+ if (e.code() != std::errc::address_in_use) {
logger.error("test_bind_same() got unexpeted error {}", e);
ceph_abort();
} else {
).then([] {
ceph_abort();
}).handle_exception_type([this] (const std::system_error& e) {
- if (e.code() != error::broken_pipe &&
- e.code() != error::connection_reset) {
+ if (e.code() != std::errc::broken_pipe &&
+ e.code() != std::errc::connection_reset) {
logger.error("dispatch_write_unbounded(): "
"unexpected error {}", e);
throw;
ceph_abort();
}).handle_exception_type([this] (const std::system_error& e) {
if (e.code() != error::read_eof
- && e.code() != error::connection_reset) {
+ && e.code() != std::errc::connection_reset) {
logger.error("dispatch_read_unbounded(): "
"unexpected error {}", e);
throw;