HADOOP-6613. Moves the RPC version check ahead of the AuthMethod check. Contributed by Kan Zhang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@953910 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Devaraj Das 2010-06-12 00:13:15 +00:00
parent fbdb249460
commit 8fa094ad6a
2 changed files with 13 additions and 10 deletions

View File

@ -84,6 +84,9 @@ Trunk (unreleased changes)
HADOOP-6620. NPE if renewer is passed as null in getDelegationToken.
(Jitendra Pandey via jghoman)
HADOOP-6613. Moves the RPC version check ahead of the AuthMethod check.
(Kan Zhang via ddas)
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES

View File

@ -1088,6 +1088,16 @@ public int readAndProcess() throws IOException, InterruptedException {
byte[] method = new byte[] {rpcHeaderBuffer.get(1)};
authMethod = AuthMethod.read(new DataInputStream(
new ByteArrayInputStream(method)));
dataLengthBuffer.flip();
if (!HEADER.equals(dataLengthBuffer) || version != CURRENT_VERSION) {
//Warning is ok since this is not supposed to happen.
LOG.warn("Incorrect header or version mismatch from " +
hostAddress + ":" + remotePort +
" got version " + version +
" expected version " + CURRENT_VERSION);
return -1;
}
dataLengthBuffer.clear();
if (authMethod == null) {
throw new IOException("Unable to read authentication method");
}
@ -1112,16 +1122,6 @@ public int readAndProcess() throws IOException, InterruptedException {
useSasl = true;
}
dataLengthBuffer.flip();
if (!HEADER.equals(dataLengthBuffer) || version != CURRENT_VERSION) {
//Warning is ok since this is not supposed to happen.
LOG.warn("Incorrect header or version mismatch from " +
hostAddress + ":" + remotePort +
" got version " + version +
" expected version " + CURRENT_VERSION);
return -1;
}
dataLengthBuffer.clear();
rpcHeaderBuffer = null;
rpcHeaderRead = true;
continue;