{
Mutex::Locker lock(monc_lock);
- if (clientid >= 0) {
+ if (state == MC_STATE_HAVE_SESSION) {
dout(5) << "already authenticated" << dendl;;
return 0;
}
if (cur_mon < 0)
_reopen_session();
- while (clientid < 0 && !authenticate_err)
+ while (state != MC_STATE_HAVE_SESSION && !authenticate_err)
authenticate_cond.Wait(monc_lock);
- if (clientid >= 0)
- dout(5) << "authenticate success, client" << clientid << dendl;
+ if (state == MC_STATE_HAVE_SESSION) {
+ dout(5) << "authenticate success, global_id" << global_id << dendl;
+ }
return authenticate_err;
}
state = MC_STATE_AUTHENTICATING;
}
assert(auth);
- if (m->global_id) {
+ if (m->global_id && m->global_id != global_id) {
global_id = m->global_id;
auth->set_global_id(global_id);
dout(10) << "my global_id is " << m->global_id << dendl;
// authenticate
private:
- client_t clientid;
Cond map_cond;
Cond authenticate_cond;
int authenticate_err;
return monmap.size();
}
- client_t get_global_id() { return clientid; }
+ uint64_t get_global_id() { return global_id; }
void set_messenger(Messenger *m) { messenger = m; }