auto peer = monmap.get_addrs(rank);
auto conn = messenger->connect_to_mon(peer);
MonConnection mc(cct, conn, global_id, &auth_registry);
+ if (auth) {
+ mc.get_auth().reset(auth->clone());
+ }
auto inserted = pending_cons.insert(make_pair(peer, move(mc)));
ldout(cct, 10) << "picked mon." << monmap.get_name(rank)
<< " con " << conn
return -EACCES;
}
- if (auth) {
- auth.reset();
- }
int r = _init_auth(*method, entity_name, want_keys, keyring, true);
ceph_assert(r == 0);
uint32_t want_keys,
RotatingKeyRing* keyring)
{
- if (auth && (int)m->protocol == auth->get_protocol()) {
- // good, negotiation completed
- auth->reset();
- return 0;
- }
-
int r = _init_auth(m->protocol, entity_name, want_keys, keyring, false);
if (r == -ENOTSUP) {
if (m->result == -ENOTSUP) {
RotatingKeyRing* keyring,
bool msgr2)
{
- ldout(cct,10) << __func__ << " method " << method << dendl;
- auth.reset(
- AuthClientHandler::create(cct, method, keyring));
+ ldout(cct, 10) << __func__ << " method " << method << dendl;
+ if (auth && auth->get_protocol() == (int)method) {
+ ldout(cct, 10) << __func__ << " already have auth, reseting" << dendl;
+ auth->reset();
+ return 0;
+ }
+
+ ldout(cct, 10) << __func__ << " creating new auth" << dendl;
+ auth.reset(AuthClientHandler::create(cct, method, keyring));
if (!auth) {
ldout(cct, 10) << " no handler for protocol " << method << dendl;
return -ENOTSUP;