hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject hadoop git commit: HDFS-11767: libhdfs++: SASL events should be scoped closer to usage. Contributed by James Clampffer
Date Thu, 11 May 2017 16:35:18 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-8707 e73bd5352 -> 356fd2214


HDFS-11767: libhdfs++: SASL events should be scoped closer to usage. Contributed by James
Clampffer


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/356fd221
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/356fd221
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/356fd221

Branch: refs/heads/HDFS-8707
Commit: 356fd2214cca62a1e51367cb4e21b73f54811a1f
Parents: e73bd53
Author: James <jhc@apache.org>
Authored: Thu May 11 12:34:35 2017 -0400
Committer: James <jhc@apache.org>
Committed: Thu May 11 12:34:35 2017 -0400

----------------------------------------------------------------------
 .../src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc        | 7 ++++---
 .../src/main/native/libhdfspp/lib/rpc/sasl_protocol.h         | 1 -
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/356fd221/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc
index 83d4f88..49abe58 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc
@@ -65,14 +65,12 @@ SaslProtocol::SaslProtocol(const std::string & cluster_name,
 
 SaslProtocol::~SaslProtocol()
 {
-  std::lock_guard<std::mutex> state_lock(sasl_state_lock_);
-  event_handlers_->call("SASL End", cluster_name_.c_str(), 0);
+  assert(state_ != kNegotiate);
 }
 
 void SaslProtocol::SetEventHandlers(std::shared_ptr<LibhdfsEvents> event_handlers)
{
   std::lock_guard<std::mutex> state_lock(sasl_state_lock_);
   event_handlers_ = event_handlers;
-  event_handlers_->call("SASL Start", cluster_name_.c_str(), 0);
 } // SetEventHandlers() method
 
 void SaslProtocol::Authenticate(std::function<void(const Status & status, const AuthInfo
new_auth_info)> callback)
@@ -81,6 +79,7 @@ void SaslProtocol::Authenticate(std::function<void(const Status &
status, const
 
   callback_ = callback;
   state_ = kNegotiate;
+  event_handlers_->call("SASL Start", cluster_name_.c_str(), 0);
 
   std::shared_ptr<RpcSaslProto> req_msg = std::make_shared<RpcSaslProto>();
   req_msg->set_state(RpcSaslProto_SaslState_NEGOTIATE);
@@ -353,6 +352,8 @@ bool SaslProtocol::SendSaslMessage(RpcSaslProto & message)
 bool SaslProtocol::AuthComplete(const Status & status, const AuthInfo & auth_info)
 {
   assert(lock_held(sasl_state_lock_));  // Must be holding lock before calling
+  state_ = kComplete;
+  event_handlers_->call("SASL End", cluster_name_.c_str(), 0);
 
   // RpcConnection might have been freed when we weren't looking.  Lock it
   //   to make sure it's there long enough for us

http://git-wip-us.apache.org/repos/asf/hadoop/blob/356fd221/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.h
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.h
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.h
index 3816cf9..a46ae08 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.h
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.h
@@ -56,7 +56,6 @@ private:
   enum State {
     kUnstarted,
     kNegotiate,
-    kAuthenticate,
     kComplete
   };
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message