interval.set_from_double(cct->_conf->mon_client_hunt_interval);
cct->init_crypto();
+ auto shutdown_crypto = make_scope_guard([this] {
+ cct->shutdown_crypto();
+ });
int r = build_initial_monmap();
if (r < 0) {
lderr(cct) << __func__ << " cannot identify monitors to contact" << dendl;
- goto out;
+ return r;
}
messenger = Messenger::create_client_messenger(
ceph_assert(messenger);
messenger->add_dispatcher_head(this);
messenger->start();
+ auto shutdown_msgr = make_scope_guard([this] {
+ messenger->shutdown();
+ messenger->wait();
+ delete messenger;
+ messenger = nullptr;
+ if (!monmap.fsid.is_zero()) {
+ cct->_conf.set_val("fsid", stringify(monmap.fsid));
+ }
+ });
while (tries-- > 0) {
r = init();
if (r < 0) {
- goto out_msgr;
+ return r;
}
r = authenticate(cct->_conf->client_mount_timeout);
if (r == -ETIMEDOUT) {
continue;
}
-out_shutdown:
shutdown();
-
-out_msgr:
- messenger->shutdown();
- messenger->wait();
- delete messenger;
- messenger = nullptr;
-
- if (!monmap.fsid.is_zero()) {
- cct->_conf.set_val("fsid", stringify(monmap.fsid));
- }
-
-out:
- cct->shutdown_crypto();
return r;
}