kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [2/7] kudu git commit: java: remove unused parts of SecureRpcHelper
Date Wed, 08 Feb 2017 22:03:06 GMT
java: remove unused parts of SecureRpcHelper

This removes the unused wrap/unwrap code from SecureRpcHelper. I also
removed an unnecessary function in TabletClient.

Change-Id: I3b70e0319060e3f2d9cc9a0ed23da7fe51b174df
Reviewed-on: http://gerrit.cloudera.org:8080/5925
Reviewed-by: Dan Burkert <danburkert@apache.org>
Reviewed-by: Jean-Daniel Cryans <jdcryans@apache.org>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/5f4bd61b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/5f4bd61b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/5f4bd61b

Branch: refs/heads/master
Commit: 5f4bd61b0ebe75402789d20e441966080383916a
Parents: 716a1fa
Author: Todd Lipcon <todd@apache.org>
Authored: Tue Feb 7 00:32:12 2017 -0800
Committer: Todd Lipcon <todd@apache.org>
Committed: Wed Feb 8 21:27:09 2017 +0000

----------------------------------------------------------------------
 .../org/apache/kudu/client/SecureRpcHelper.java | 45 +-------------------
 .../org/apache/kudu/client/TabletClient.java    | 10 +----
 2 files changed, 3 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/5f4bd61b/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java b/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
index 3ada9f1..a0cac5a 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/SecureRpcHelper.java
@@ -50,7 +50,6 @@ import com.google.common.collect.Sets;
 import com.google.protobuf.ZeroCopyLiteralByteString;
 
 import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
 import org.jboss.netty.channel.Channel;
 import org.jboss.netty.channel.Channels;
 import org.slf4j.Logger;
@@ -82,7 +81,6 @@ public class SecureRpcHelper {
   private static final Set<RpcHeader.RpcFeatureFlag> SUPPORTED_RPC_FEATURES =
       ImmutableSet.of(RpcHeader.RpcFeatureFlag.APPLICATION_FEATURE_FLAGS);
   private volatile boolean negoUnderway = true;
-  private boolean useWrap = false; // no QOP at the moment
   private Set<RpcHeader.RpcFeatureFlag> serverFeatures;
 
   public SecureRpcHelper(final TabletClient client) {
@@ -138,50 +136,9 @@ public class SecureRpcHelper {
       }
       return null;
     }
-    return unwrap(buf);
+    return buf;
   }
 
-  /**
-   * When QOP of auth-int or auth-conf is selected
-   * This is used to unwrap the contents from the passed
-   * buffer payload.
-   */
-  public ChannelBuffer unwrap(ChannelBuffer payload) {
-    if (!useWrap) {
-      return payload;
-    }
-    int len = payload.readInt();
-    try {
-      payload =
-          ChannelBuffers.wrappedBuffer(saslClient.unwrap(payload.readBytes(len).array(),
0, len));
-      return payload;
-    } catch (SaslException e) {
-      throw new IllegalStateException("Failed to unwrap payload", e);
-    }
-  }
-
-  /**
-   * When QOP of auth-int or auth-conf is selected
-   * This is used to wrap the contents
-   * into the proper payload (ie encryption, signature, etc)
-   */
-  public ChannelBuffer wrap(ChannelBuffer content) {
-    if (!useWrap) {
-      return content;
-    }
-    try {
-      byte[] payload = new byte[content.writerIndex()];
-      content.readBytes(payload);
-      byte[] wrapped = saslClient.wrap(payload, 0, payload.length);
-      ChannelBuffer ret = ChannelBuffers.wrappedBuffer(new byte[4 + wrapped.length]);
-      ret.clear();
-      ret.writeInt(wrapped.length);
-      ret.writeBytes(wrapped);
-      return ret;
-    } catch (SaslException e) {
-      throw new IllegalStateException("Failed to wrap payload", e);
-    }
-  }
 
   private RpcHeader.NegotiatePB parseSaslMsgResponse(ChannelBuffer buf) {
     CallResponse response = new CallResponse(buf);

http://git-wip-us.apache.org/repos/asf/kudu/blob/5f4bd61b/java/kudu-client/src/main/java/org/apache/kudu/client/TabletClient.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/main/java/org/apache/kudu/client/TabletClient.java b/java/kudu-client/src/main/java/org/apache/kudu/client/TabletClient.java
index 4550751..592aaff 100644
--- a/java/kudu-client/src/main/java/org/apache/kudu/client/TabletClient.java
+++ b/java/kudu-client/src/main/java/org/apache/kudu/client/TabletClient.java
@@ -283,8 +283,6 @@ public class TabletClient extends ReplayingDecoder<VoidEnum> {
           ", payload=" + payload);
     }
 
-    payload = secureRpcHelper.wrap(payload);
-
     return new Pair<>(payload, rpcid);
   }
 
@@ -807,11 +805,6 @@ public class TabletClient extends ReplayingDecoder<VoidEnum> {
     return ChannelBuffers.wrappedBuffer(RPC_HEADER);
   }
 
-  public void becomeReady(Channel chan) {
-    this.chan = chan;
-    sendQueuedRpcs();
-  }
-
   /**
    * Sends the queued RPCs to the server, once we're connected to it.
    * This gets called after {@link #channelConnected}, once we were able to
@@ -833,7 +826,8 @@ public class TabletClient extends ReplayingDecoder<VoidEnum> {
 
   void sendContext(Channel channel) {
     Channels.write(channel,  header());
-    becomeReady(channel);
+    this.chan = channel;
+    sendQueuedRpcs();
   }
 
   private ChannelBuffer header() {


Mime
View raw message