This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 93c1a74  [rpc] minor cleanup on messenger.{h,cc}
93c1a74 is described below

commit 93c1a743c4d60c63588ad7cc6b071e7ead707458
Author: Alexey Serbin <ale...@apache.org>
AuthorDate: Mon Mar 22 18:41:40 2021 -0700

    [rpc] minor cleanup on messenger.{h,cc}
    
    Minor code style-related clean-up on messenger.h and messenger.cc files:
      * removed 'using ...' from messenger.h
      * moved ampersand and asterisk to the type
      * other nits
    
    Change-Id: Id623a7d69c2d702cec3233d9282930e9bbd865ee
    Reviewed-on: http://gerrit.cloudera.org:8080/17216
    Tested-by: Alexey Serbin <aser...@cloudera.com>
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/rpc/client_negotiation.cc |   9 +--
 src/kudu/rpc/client_negotiation.h  |   5 +-
 src/kudu/rpc/messenger.cc          | 120 +++--------------------------------
 src/kudu/rpc/messenger.h           | 126 ++++++++++++++++++++++++++-----------
 src/kudu/rpc/negotiation-test.cc   |  13 ++--
 src/kudu/rpc/negotiation.cc        |   3 +-
 src/kudu/rpc/server_negotiation.cc |   2 +-
 src/kudu/rpc/server_negotiation.h  |   8 +--
 8 files changed, 117 insertions(+), 169 deletions(-)

diff --git a/src/kudu/rpc/client_negotiation.cc 
b/src/kudu/rpc/client_negotiation.cc
index d876e35..ef9b368 100644
--- a/src/kudu/rpc/client_negotiation.cc
+++ b/src/kudu/rpc/client_negotiation.cc
@@ -24,7 +24,6 @@
 #include <cstdint>
 #include <cstring>
 #include <functional>
-#include <map>
 #include <memory>
 #include <ostream>
 #include <set>
@@ -40,7 +39,6 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rpc/blocking_ops.h"
 #include "kudu/rpc/constants.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/rpc_header.pb.h"
 #include "kudu/rpc/sasl_common.h"
 #include "kudu/rpc/sasl_helper.h"
@@ -64,15 +62,14 @@
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif // #if defined(__APPLE__)
 
-using std::map;
+DECLARE_bool(rpc_encrypt_loopback_connections);
+
+using kudu::security::RpcEncryption;
 using std::set;
 using std::string;
 using std::unique_ptr;
-
 using strings::Substitute;
 
-DECLARE_bool(rpc_encrypt_loopback_connections);
-
 namespace kudu {
 namespace rpc {
 
diff --git a/src/kudu/rpc/client_negotiation.h 
b/src/kudu/rpc/client_negotiation.h
index 436d7b6..e9f0c7d 100644
--- a/src/kudu/rpc/client_negotiation.h
+++ b/src/kudu/rpc/client_negotiation.h
@@ -30,7 +30,6 @@
 #include <glog/logging.h>
 
 #include "kudu/gutil/port.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/negotiation.h"
 #include "kudu/rpc/rpc_header.pb.h"
 #include "kudu/rpc/sasl_common.h"
@@ -66,7 +65,7 @@ class ClientNegotiation {
   ClientNegotiation(std::unique_ptr<Socket> socket,
                     const security::TlsContext* tls_context,
                     boost::optional<security::SignedTokenPB> authn_token,
-                    RpcEncryption encryption,
+                    security::RpcEncryption encryption,
                     std::string sasl_proto_name);
 
   // Enable PLAIN authentication.
@@ -228,7 +227,7 @@ class ClientNegotiation {
   // TLS state.
   const security::TlsContext* tls_context_;
   security::TlsHandshake tls_handshake_;
-  const RpcEncryption encryption_;
+  const security::RpcEncryption encryption_;
   bool tls_negotiated_;
 
   // TSK state.
diff --git a/src/kudu/rpc/messenger.cc b/src/kudu/rpc/messenger.cc
index 08716b7..aea9ab8 100644
--- a/src/kudu/rpc/messenger.cc
+++ b/src/kudu/rpc/messenger.cc
@@ -53,9 +53,10 @@
 #include "kudu/util/thread_restrictions.h"
 #include "kudu/util/threadpool.h"
 
+using kudu::security::RpcAuthentication;
+using kudu::security::RpcEncryption;
 using std::string;
 using std::shared_ptr;
-using std::make_shared;
 using std::unique_ptr;
 using strings::Substitute;
 
@@ -64,7 +65,7 @@ namespace rpc {
 
 const int64_t MessengerBuilder::kRpcNegotiationTimeoutMs = 3000;
 
-MessengerBuilder::MessengerBuilder(std::string name)
+MessengerBuilder::MessengerBuilder(string name)
     : name_(std::move(name)),
       connection_keepalive_time_(MonoDelta::FromMilliseconds(65000)),
       num_reactors_(4),
@@ -81,105 +82,6 @@ MessengerBuilder::MessengerBuilder(std::string name)
       reuseport_(false) {
 }
 
-MessengerBuilder& MessengerBuilder::set_connection_keepalive_time(const 
MonoDelta &keepalive) {
-  connection_keepalive_time_ = keepalive;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_num_reactors(int num_reactors) {
-  num_reactors_ = num_reactors;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_min_negotiation_threads(int 
min_negotiation_threads) {
-  min_negotiation_threads_ = min_negotiation_threads;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_max_negotiation_threads(int 
max_negotiation_threads) {
-  max_negotiation_threads_ = max_negotiation_threads;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_coarse_timer_granularity(const 
MonoDelta &granularity) {
-  coarse_timer_granularity_ = granularity;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_metric_entity(
-    const scoped_refptr<MetricEntity>& metric_entity) {
-  metric_entity_ = metric_entity;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_connection_keep_alive_time(int32_t 
time_in_ms) {
-  connection_keepalive_time_ = MonoDelta::FromMilliseconds(time_in_ms);
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_rpc_negotiation_timeout_ms(int64_t 
time_in_ms) {
-  rpc_negotiation_timeout_ms_ = time_in_ms;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_sasl_proto_name(const std::string& 
sasl_proto_name) {
-  sasl_proto_name_ = sasl_proto_name;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_rpc_authentication(const std::string& 
rpc_authentication) {
-  rpc_authentication_ = rpc_authentication;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_rpc_encryption(const std::string& 
rpc_encryption) {
-  rpc_encryption_ = rpc_encryption;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_rpc_tls_ciphers(const std::string& 
rpc_tls_ciphers) {
-  rpc_tls_ciphers_ = rpc_tls_ciphers;
-  return *this;
-}
-
-MessengerBuilder &MessengerBuilder::set_rpc_tls_min_protocol(
-    const std::string& rpc_tls_min_protocol) {
-  rpc_tls_min_protocol_ = rpc_tls_min_protocol;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_epki_cert_key_files(
-    const std::string& cert, const std::string& private_key) {
-  rpc_certificate_file_ = cert;
-  rpc_private_key_file_ = private_key;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_epki_certificate_authority_file(const 
std::string& ca) {
-  rpc_ca_certificate_file_ = ca;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_epki_private_password_key_cmd(const 
std::string& cmd) {
-  rpc_private_key_password_cmd_ = cmd;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_keytab_file(const std::string& 
keytab_file) {
-  keytab_file_ = keytab_file;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::enable_inbound_tls() {
-  enable_inbound_tls_ = true;
-  return *this;
-}
-
-MessengerBuilder& MessengerBuilder::set_reuseport() {
-  reuseport_ = true;
-  return *this;
-}
-
 Status MessengerBuilder::Build(shared_ptr<Messenger>* msgr) {
   // Initialize SASL library before we start making requests
   RETURN_NOT_OK(SaslInit(!keytab_file_.empty()));
@@ -189,15 +91,12 @@ Status MessengerBuilder::Build(shared_ptr<Messenger>* 
msgr) {
   // Note: can't use make_shared() as it doesn't support custom deleters.
   shared_ptr<Messenger> new_msgr(new Messenger(*this),
                                  
std::mem_fn(&Messenger::AllExternalReferencesDropped));
-
   RETURN_NOT_OK(ParseTriState("--rpc_authentication",
                               rpc_authentication_,
                               &new_msgr->authentication_));
-
   RETURN_NOT_OK(ParseTriState("--rpc_encryption",
                               rpc_encryption_,
                               &new_msgr->encryption_));
-
   RETURN_NOT_OK(new_msgr->Init());
   if (new_msgr->encryption_ != RpcEncryption::DISABLED && enable_inbound_tls_) 
{
     auto* tls_context = new_msgr->mutable_tls_context();
@@ -298,7 +197,7 @@ void Messenger::ShutdownInternal(ShutdownMode mode) {
   }
 }
 
-Status Messenger::AddAcceptorPool(const Sockaddr &accept_addr,
+Status Messenger::AddAcceptorPool(const Sockaddr& accept_addr,
                                   shared_ptr<AcceptorPool>* pool) {
   // Before listening, if we expect to require Kerberos, we want to verify
   // that everything is set up correctly. This way we'll generate errors on
@@ -317,7 +216,7 @@ Status Messenger::AddAcceptorPool(const Sockaddr 
&accept_addr,
   RETURN_NOT_OK(sock.Bind(accept_addr));
   Sockaddr remote;
   RETURN_NOT_OK(sock.GetSocketAddress(&remote));
-  auto acceptor_pool(make_shared<AcceptorPool>(this, &sock, remote));
+  auto acceptor_pool(std::make_shared<AcceptorPool>(this, &sock, remote));
 
   std::lock_guard<percpu_rwlock> guard(lock_);
   acceptor_pools_.push_back(acceptor_pool);
@@ -334,9 +233,8 @@ Status Messenger::RegisterService(const string& 
service_name,
   DCHECK_NE(kClosing, state_);
   if (InsertIfNotPresent(&rpc_services_, service_name, service)) {
     return Status::OK();
-  } else {
-    return Status::AlreadyPresent("This service is already present");
   }
+  return Status::AlreadyPresent("This service is already present");
 }
 
 void Messenger::UnregisterAllServices() {
@@ -440,12 +338,10 @@ Messenger::~Messenger() {
   STLDeleteElements(&reactors_);
 }
 
-Reactor* Messenger::RemoteToReactor(const Sockaddr &remote) {
-  uint32_t hashCode = remote.HashCode();
-  int reactor_idx = hashCode % reactors_.size();
+Reactor* Messenger::RemoteToReactor(const Sockaddr& remote) {
   // This is just a static partitioning; we could get a lot
   // fancier with assigning Sockaddrs to Reactors.
-  return reactors_[reactor_idx];
+  return reactors_[remote.HashCode() % reactors_.size()];
 }
 
 Status Messenger::Init() {
diff --git a/src/kudu/rpc/messenger.h b/src/kudu/rpc/messenger.h
index 2d34f30..b1e22de 100644
--- a/src/kudu/rpc/messenger.h
+++ b/src/kudu/rpc/messenger.h
@@ -47,13 +47,10 @@ class ThreadPool;
 namespace security {
 class TlsContext;
 class TokenVerifier;
-}
+} // namespace security
 
 namespace rpc {
 
-using security::RpcAuthentication;
-using security::RpcEncryption;
-
 class AcceptorPool;
 class DumpConnectionsRequestPB;
 class DumpConnectionsResponsePB;
@@ -87,80 +84,140 @@ class MessengerBuilder {
   explicit MessengerBuilder(std::string name);
 
   // Set the length of time we will keep a TCP connection will alive with no 
traffic.
-  MessengerBuilder &set_connection_keepalive_time(const MonoDelta &keepalive);
+  MessengerBuilder& set_connection_keepalive_time(const MonoDelta& keepalive) {
+    connection_keepalive_time_ = keepalive;
+    return *this;
+  }
 
   // Set the number of reactor threads that will be used for sending and
   // receiving.
-  MessengerBuilder &set_num_reactors(int num_reactors);
+  MessengerBuilder& set_num_reactors(int num_reactors) {
+    num_reactors_ = num_reactors;
+    return *this;
+  }
 
   // Set the minimum number of connection-negotiation threads that will be used
   // to handle the blocking connection-negotiation step.
-  MessengerBuilder &set_min_negotiation_threads(int min_negotiation_threads);
+  MessengerBuilder& set_min_negotiation_threads(int min_negotiation_threads) {
+    min_negotiation_threads_ = min_negotiation_threads;
+    return *this;
+  }
 
   // Set the maximum number of connection-negotiation threads that will be used
   // to handle the blocking connection-negotiation step.
-  MessengerBuilder &set_max_negotiation_threads(int max_negotiation_threads);
+  MessengerBuilder& set_max_negotiation_threads(int max_negotiation_threads) {
+    max_negotiation_threads_ = max_negotiation_threads;
+    return *this;
+  }
 
   // Set the granularity with which connections are checked for keepalive.
-  MessengerBuilder &set_coarse_timer_granularity(const MonoDelta &granularity);
+  MessengerBuilder& set_coarse_timer_granularity(const MonoDelta& granularity) 
{
+    coarse_timer_granularity_ = granularity;
+    return *this;
+  }
 
   // Set metric entity for use by RPC systems.
-  MessengerBuilder &set_metric_entity(const scoped_refptr<MetricEntity>& 
metric_entity);
+  MessengerBuilder& set_metric_entity(
+      const scoped_refptr<MetricEntity>& metric_entity) {
+    metric_entity_ = metric_entity;
+    return *this;
+  }
 
   // Set the time in milliseconds after which an idle connection from a client 
will be
   // disconnected by the server.
-  MessengerBuilder &set_connection_keep_alive_time(int32_t time_in_ms);
+  MessengerBuilder& set_connection_keep_alive_time(int32_t time_in_ms) {
+    connection_keepalive_time_ = MonoDelta::FromMilliseconds(time_in_ms);
+    return *this;
+  }
 
   // Set the timeout for negotiating an RPC connection.
-  MessengerBuilder &set_rpc_negotiation_timeout_ms(int64_t time_in_ms);
+  MessengerBuilder& set_rpc_negotiation_timeout_ms(int64_t time_in_ms) {
+    rpc_negotiation_timeout_ms_ = time_in_ms;
+    return *this;
+  }
 
   // Set the SASL protocol name that is used for the SASL negotiation.
-  MessengerBuilder &set_sasl_proto_name(const std::string& sasl_proto_name);
+  MessengerBuilder& set_sasl_proto_name(const std::string& sasl_proto_name) {
+    sasl_proto_name_ = sasl_proto_name;
+    return *this;
+  }
 
   // Set the state of authentication required. If 'optional', authentication 
will be used when
   // the remote end supports it. If 'required', connections which are not able 
to authenticate
   // (because the remote end lacks support) are rejected.
-  MessengerBuilder &set_rpc_authentication(const std::string& 
rpc_authentication);
+  MessengerBuilder& set_rpc_authentication(const std::string& 
rpc_authentication) {
+    rpc_authentication_ = rpc_authentication;
+    return *this;
+  }
 
   // Set the state of encryption required. If 'optional', encryption will be 
used when the
   // remote end supports it. If 'required', connections which are not able to 
use encryption
   // (because the remote end lacks support) are rejected. If 'disabled', 
encryption will not
   // be used, and RPC authentication (--rpc_authentication) must also be 
disabled as well.
-  MessengerBuilder &set_rpc_encryption(const std::string& rpc_encryption);
+  MessengerBuilder& set_rpc_encryption(const std::string& rpc_encryption) {
+    rpc_encryption_ = rpc_encryption;
+    return *this;
+  }
 
   // Set the cipher suite preferences to use for TLS-secured RPC connections. 
Uses the OpenSSL
   // cipher preference list format. See man (1) ciphers for more information.
-  MessengerBuilder &set_rpc_tls_ciphers(const std::string& rpc_tls_ciphers);
+  MessengerBuilder& set_rpc_tls_ciphers(const std::string& rpc_tls_ciphers) {
+    rpc_tls_ciphers_ = rpc_tls_ciphers;
+    return *this;
+  }
 
   // Set the minimum protocol version to allow when for securing RPC 
connections with TLS. May be
   // one of 'TLSv1', 'TLSv1.1', or 'TLSv1.2'.
-  MessengerBuilder &set_rpc_tls_min_protocol(const std::string& 
rpc_tls_min_protocol);
+  MessengerBuilder& set_rpc_tls_min_protocol(
+      const std::string& rpc_tls_min_protocol) {
+    rpc_tls_min_protocol_ = rpc_tls_min_protocol;
+    return *this;
+  }
 
   // Set the TLS server certificate and private key files paths. If this is 
set in conjunction
   // with enable_inbound_tls(), internal PKI will not be used for encrypted 
communication and
   // external PKI will be used instead.
-  MessengerBuilder &set_epki_cert_key_files(
-      const std::string& cert, const std::string& private_key);
+  MessengerBuilder& set_epki_cert_key_files(
+      const std::string& cert, const std::string& private_key) {
+    rpc_certificate_file_ = cert;
+    rpc_private_key_file_ = private_key;
+    return *this;
+  }
 
   // Set the TLS Certificate Authority file path. Must always be set with 
set_epki_cert_key_files().
   // If this is set in conjunction with enable_inbound_tls(), internal PKI 
will not be used for
   // encrypted communication and external PKI will be used instead.
-  MessengerBuilder &set_epki_certificate_authority_file(const std::string& ca);
+  MessengerBuilder& set_epki_certificate_authority_file(const std::string& ca) 
{
+    rpc_ca_certificate_file_ = ca;
+    return *this;
+  }
 
   // Set a Unix command whose output returns the password used to decrypt the 
RPC server's private
   // key file specified via set_epki_cert_key_files(). If the .PEM key file is 
not
   // password-protected, this flag does not need to be set. Trailing 
whitespace will be trimmed
   // before it is used to decrypt the private key.
-  MessengerBuilder &set_epki_private_password_key_cmd(const std::string& cmd);
+  MessengerBuilder& set_epki_private_password_key_cmd(const std::string& cmd) {
+    rpc_private_key_password_cmd_ = cmd;
+    return *this;
+  }
 
   // Set the path to the Kerberos Keytab file for this server.
-  MessengerBuilder &set_keytab_file(const std::string& keytab_file);
+  MessengerBuilder& set_keytab_file(const std::string& keytab_file) {
+    keytab_file_ = keytab_file;
+    return *this;
+  }
 
   // Configure the messenger to enable TLS encryption on inbound connections.
-  MessengerBuilder& enable_inbound_tls();
+  MessengerBuilder& enable_inbound_tls() {
+    enable_inbound_tls_ = true;
+    return *this;
+  }
 
   // Configure the messenger to set the SO_REUSEPORT socket option.
-  MessengerBuilder& set_reuseport();
+  MessengerBuilder& set_reuseport() {
+    reuseport_ = true;
+    return *this;
+  }
 
   Status Build(std::shared_ptr<Messenger>* msgr);
 
@@ -231,7 +288,7 @@ class Messenger {
   // If Kerberos is enabled, this also runs a pre-flight check that makes
   // sure the environment is appropriately configured to authenticate
   // clients via Kerberos. If not, this returns a RuntimeError.
-  Status AddAcceptorPool(const Sockaddr &accept_addr,
+  Status AddAcceptorPool(const Sockaddr& accept_addr,
                          std::shared_ptr<AcceptorPool>* pool);
 
   // Register a new RpcService to handle inbound requests.
@@ -252,16 +309,16 @@ class Messenger {
 
   // Queue a call for transmission. This will pick the appropriate reactor,
   // and enqueue a task on that reactor to assign and send the call.
-  void QueueOutboundCall(const std::shared_ptr<OutboundCall> &call);
+  void QueueOutboundCall(const std::shared_ptr<OutboundCall>& call);
 
   // Enqueue a call for processing on the server.
   void QueueInboundCall(std::unique_ptr<InboundCall> call);
 
   // Queue a cancellation for the given outbound call.
-  void QueueCancellation(const std::shared_ptr<OutboundCall> &call);
+  void QueueCancellation(const std::shared_ptr<OutboundCall>& call);
 
   // Take ownership of the socket via Socket::Release
-  void RegisterInboundSocket(Socket *new_socket, const Sockaddr &remote);
+  void RegisterInboundSocket(Socket* new_socket, const Sockaddr& remote);
 
   // Dump info on related TCP connections into the given protobuf.
   Status DumpConnections(const DumpConnectionsRequestPB& req,
@@ -292,8 +349,8 @@ class Messenger {
     authn_token_ = token;
   }
 
-  RpcAuthentication authentication() const { return authentication_; }
-  RpcEncryption encryption() const { return encryption_; }
+  security::RpcAuthentication authentication() const { return authentication_; 
}
+  security::RpcEncryption encryption() const { return encryption_; }
 
   ThreadPool* negotiation_pool(Connection::Direction dir);
 
@@ -337,9 +394,9 @@ class Messenger {
   FRIEND_TEST(TestRpc, TestConnectionNetworkPlane);
   FRIEND_TEST(TestRpc, TestReopenOutboundConnections);
 
-  explicit Messenger(const MessengerBuilder &bld);
+  explicit Messenger(const MessengerBuilder& bld);
 
-  Reactor* RemoteToReactor(const Sockaddr &remote);
+  Reactor* RemoteToReactor(const Sockaddr& remote);
   Status Init();
   void RunTimeoutThread();
   void UpdateCurTime();
@@ -384,8 +441,8 @@ class Messenger {
   // by this messenger.
   // TODO(KUDU-1928): scope these to individual proxies, so that messengers 
can be
   // reused by different clients.
-  RpcAuthentication authentication_;
-  RpcEncryption encryption_;
+  security::RpcAuthentication authentication_;
+  security::RpcEncryption encryption_;
 
   // Pools which are listening on behalf of this messenger.
   // Note that the user may have called Shutdown() on one of these
@@ -478,4 +535,3 @@ class Messenger {
 
 } // namespace rpc
 } // namespace kudu
-
diff --git a/src/kudu/rpc/negotiation-test.cc b/src/kudu/rpc/negotiation-test.cc
index 8b2db2d..3983ff0 100644
--- a/src/kudu/rpc/negotiation-test.cc
+++ b/src/kudu/rpc/negotiation-test.cc
@@ -17,6 +17,7 @@
 
 #include "kudu/rpc/negotiation.h"
 
+#include <krb5/krb5.h> // IWYU pragma: keep
 #include <sasl/sasl.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -31,7 +32,6 @@
 #include <utility>
 #include <vector>
 
-#include <krb5/krb5.h> // IWYU pragma: keep
 #include <boost/optional/optional.hpp>
 #include <gflags/gflags.h>
 #include <glog/logging.h>
@@ -42,7 +42,6 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/gutil/walltime.h"
 #include "kudu/rpc/client_negotiation.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/remote_user.h"
 #include "kudu/rpc/rpc-test-base.h"
 #include "kudu/rpc/sasl_common.h"
@@ -93,19 +92,19 @@ DEFINE_bool(is_test_child, false,
 DECLARE_bool(rpc_encrypt_loopback_connections);
 DECLARE_bool(rpc_trace_negotiation);
 
-using std::string;
-using std::thread;
-using std::unique_ptr;
-using std::vector;
-
 using kudu::security::Cert;
 using kudu::security::PkiConfig;
 using kudu::security::PrivateKey;
+using kudu::security::RpcEncryption;
 using kudu::security::SignedTokenPB;
 using kudu::security::TlsContext;
 using kudu::security::TokenSigner;
 using kudu::security::TokenSigningPrivateKey;
 using kudu::security::TokenVerifier;
+using std::string;
+using std::thread;
+using std::unique_ptr;
+using std::vector;
 
 namespace kudu {
 namespace rpc {
diff --git a/src/kudu/rpc/negotiation.cc b/src/kudu/rpc/negotiation.cc
index 31e0b33..71c23f7 100644
--- a/src/kudu/rpc/negotiation.cc
+++ b/src/kudu/rpc/negotiation.cc
@@ -43,7 +43,6 @@
 #include "kudu/rpc/server_negotiation.h"
 #include "kudu/rpc/user_credentials.h"
 #include "kudu/security/tls_context.h"
-#include "kudu/security/token.pb.h"
 #include "kudu/util/errno.h"
 #include "kudu/util/flag_tags.h"
 #include "kudu/util/logging.h"
@@ -72,6 +71,8 @@ DEFINE_bool(rpc_encrypt_loopback_connections, false,
             "an attacker.");
 TAG_FLAG(rpc_encrypt_loopback_connections, advanced);
 
+using kudu::security::RpcAuthentication;
+using kudu::security::RpcEncryption;
 using std::string;
 using std::unique_ptr;
 using strings::Substitute;
diff --git a/src/kudu/rpc/server_negotiation.cc 
b/src/kudu/rpc/server_negotiation.cc
index e7936ba..61ba0ed 100644
--- a/src/kudu/rpc/server_negotiation.cc
+++ b/src/kudu/rpc/server_negotiation.cc
@@ -41,7 +41,6 @@
 #include "kudu/gutil/strings/substitute.h"
 #include "kudu/rpc/blocking_ops.h"
 #include "kudu/rpc/constants.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/rpc_verification_util.h"
 #include "kudu/rpc/serialization.h"
 #include "kudu/security/cert.h"
@@ -68,6 +67,7 @@
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif // #if defined(__APPLE__)
 
+using kudu::security::RpcEncryption;
 using std::set;
 using std::string;
 using std::unique_ptr;
diff --git a/src/kudu/rpc/server_negotiation.h 
b/src/kudu/rpc/server_negotiation.h
index 7935569..021f55d 100644
--- a/src/kudu/rpc/server_negotiation.h
+++ b/src/kudu/rpc/server_negotiation.h
@@ -17,6 +17,8 @@
 
 #pragma once
 
+#include <sasl/sasl.h>
+
 #include <memory>
 #include <set>
 #include <string>
@@ -25,10 +27,8 @@
 
 #include <boost/optional/optional.hpp>
 #include <glog/logging.h>
-#include <sasl/sasl.h>
 
 #include "kudu/gutil/port.h"
-#include "kudu/rpc/messenger.h"
 #include "kudu/rpc/negotiation.h"
 #include "kudu/rpc/remote_user.h"
 #include "kudu/rpc/rpc_header.pb.h"
@@ -65,7 +65,7 @@ class ServerNegotiation {
   ServerNegotiation(std::unique_ptr<Socket> socket,
                     const security::TlsContext* tls_context,
                     const security::TokenVerifier* token_verifier,
-                    RpcEncryption encryption,
+                    security::RpcEncryption encryption,
                     std::string sasl_proto_name);
 
   // Enable PLAIN authentication.
@@ -227,7 +227,7 @@ class ServerNegotiation {
   // TLS state.
   const security::TlsContext* tls_context_;
   security::TlsHandshake tls_handshake_;
-  const RpcEncryption encryption_;
+  const security::RpcEncryption encryption_;
   bool tls_negotiated_;
 
   // TSK state.

Reply via email to