mirror of
https://github.com/ceph/ceph
synced 2025-01-01 08:32:24 +00:00
crimson/mon: extract mon::Client::_finish_auth()
for better readability Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
e806c4085d
commit
70ba744667
@ -975,41 +975,9 @@ seastar::future<> Client::reopen_session(int rank)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).then([peer, this](auto result) {
|
}).then([peer, this](auto result) {
|
||||||
if (result == Connection::AuthResult::canceled) {
|
if (result != Connection::AuthResult::canceled) {
|
||||||
return seastar::now();
|
_finish_auth(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_hunting()) {
|
|
||||||
return seastar::now();
|
|
||||||
}
|
|
||||||
logger().info("found mon.{}", monmap.get_name(peer));
|
|
||||||
|
|
||||||
auto found = std::find_if(
|
|
||||||
pending_conns.begin(), pending_conns.end(),
|
|
||||||
[peer](auto& conn) {
|
|
||||||
return conn->is_my_peer(peer);
|
|
||||||
});
|
|
||||||
if (found == pending_conns.end()) {
|
|
||||||
// Happens if another connection has won the race
|
|
||||||
ceph_assert(active_con && pending_conns.empty());
|
|
||||||
logger().info(
|
|
||||||
"no pending connection for mon.{}, peer {}",
|
|
||||||
monmap.get_name(peer),
|
|
||||||
peer);
|
|
||||||
return seastar::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
ceph_assert(!active_con && !pending_conns.empty());
|
|
||||||
active_con = std::move(*found);
|
|
||||||
found->reset();
|
|
||||||
for (auto& conn : pending_conns) {
|
|
||||||
if (conn) {
|
|
||||||
conn->close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pending_conns.clear();
|
|
||||||
return seastar::now();
|
|
||||||
}).then([]() {
|
|
||||||
logger().debug("reopen_session mon connection attempts complete");
|
logger().debug("reopen_session mon connection attempts complete");
|
||||||
}).handle_exception([](auto ep) {
|
}).handle_exception([](auto ep) {
|
||||||
logger().error("mon connections failed with ep {}", ep);
|
logger().error("mon connections failed with ep {}", ep);
|
||||||
@ -1024,6 +992,37 @@ seastar::future<> Client::reopen_session(int rank)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::_finish_auth(const entity_addr_t& peer)
|
||||||
|
{
|
||||||
|
if (!is_hunting()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
logger().info("found mon.{}", monmap.get_name(peer));
|
||||||
|
|
||||||
|
auto found = std::find_if(
|
||||||
|
pending_conns.begin(), pending_conns.end(),
|
||||||
|
[peer](auto& conn) {
|
||||||
|
return conn->is_my_peer(peer);
|
||||||
|
});
|
||||||
|
if (found == pending_conns.end()) {
|
||||||
|
// Happens if another connection has won the race
|
||||||
|
ceph_assert(active_con && pending_conns.empty());
|
||||||
|
logger().info("no pending connection for mon.{}, peer {}",
|
||||||
|
monmap.get_name(peer), peer);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ceph_assert(!active_con && !pending_conns.empty());
|
||||||
|
active_con = std::move(*found);
|
||||||
|
found->reset();
|
||||||
|
for (auto& conn : pending_conns) {
|
||||||
|
if (conn) {
|
||||||
|
conn->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pending_conns.clear();
|
||||||
|
}
|
||||||
|
|
||||||
Client::command_result_t
|
Client::command_result_t
|
||||||
Client::run_command(const std::vector<std::string>& cmd,
|
Client::run_command(const std::vector<std::string>& cmd,
|
||||||
const bufferlist& bl)
|
const bufferlist& bl)
|
||||||
|
@ -163,6 +163,7 @@ private:
|
|||||||
seastar::future<> reopen_session(int rank);
|
seastar::future<> reopen_session(int rank);
|
||||||
std::vector<unsigned> get_random_mons(unsigned n) const;
|
std::vector<unsigned> get_random_mons(unsigned n) const;
|
||||||
seastar::future<> _add_conn(unsigned rank, uint64_t global_id);
|
seastar::future<> _add_conn(unsigned rank, uint64_t global_id);
|
||||||
|
void _finish_auth(const entity_addr_t& peer);
|
||||||
crimson::common::Gated gate;
|
crimson::common::Gated gate;
|
||||||
|
|
||||||
// messages that are waiting for the active_con to be available
|
// messages that are waiting for the active_con to be available
|
||||||
|
Loading…
Reference in New Issue
Block a user