瀏覽代碼

HDFS-12104: libhdfs++: Make sure all steps in SaslProtocol end up calling AuthComplete. Contributed by James Clampffer.

James Clampffer 7 年之前
父節點
當前提交
d5edf0f365

+ 2 - 0
hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc

@@ -87,6 +87,7 @@ void SaslProtocol::Authenticate(std::function<void(const Status & status, const
   // We cheat here since this is always called while holding the RpcConnection's lock
   std::shared_ptr<RpcConnection> connection = connection_.lock();
   if (!connection) {
+    AuthComplete(Status::AuthenticationFailed("Lost RPC Connection"), AuthInfo());
     return;
   }
 
@@ -335,6 +336,7 @@ bool SaslProtocol::SendSaslMessage(RpcSaslProto & message)
   std::shared_ptr<RpcConnection> connection = connection_.lock();
   if (!connection) {
     LOG_DEBUG(kRPC, << "Tried sending a SASL Message but the RPC connection was gone");
+    AuthComplete(Status::AuthenticationFailed("Lost RPC Connection"), AuthInfo());
     return false;
   }