From 85a25b5e3bbe6cb99e1b1fd9027874e1f5e67f1a Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 18 Nov 2009 15:29:56 -0800 Subject: [PATCH] auth: fix monclient startup issue --- src/mon/MonClient.cc | 11 ++++++----- src/mon/MonClient.h | 3 +-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mon/MonClient.cc b/src/mon/MonClient.cc index 8c54b2cfb5b72..ee00704825dee 100644 --- a/src/mon/MonClient.cc +++ b/src/mon/MonClient.cc @@ -263,7 +263,7 @@ int MonClient::authenticate(double timeout) { Mutex::Locker lock(monc_lock); - if (clientid >= 0) { + if (state == MC_STATE_HAVE_SESSION) { dout(5) << "already authenticated" << dendl;; return 0; } @@ -272,11 +272,12 @@ int MonClient::authenticate(double timeout) 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; } @@ -301,7 +302,7 @@ void MonClient::handle_auth(MAuthReply *m) 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; diff --git a/src/mon/MonClient.h b/src/mon/MonClient.h index 369ee193c8932..3f6efeeb6626c 100644 --- a/src/mon/MonClient.h +++ b/src/mon/MonClient.h @@ -92,7 +92,6 @@ private: // authenticate private: - client_t clientid; Cond map_cond; Cond authenticate_cond; int authenticate_err; @@ -217,7 +216,7 @@ public: 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; } -- 2.39.5