Skip to content

Commit

Permalink
HBASE-25586 Fix HBASE-22492 on branch-2 (SASL GapToken) (#2961)
Browse files Browse the repository at this point in the history
ServerCall.java: calling wrapWithSasl() was moved to getResponse(), so
the SASL wrapping is delayed until the reply is sent back to the client.

Signed-off-by: Peter Somogyi <[email protected]>
  • Loading branch information
meszibalu committed Feb 26, 2021
1 parent db4f2bf commit 1c49ffd
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ public synchronized void setResponse(Message m, final CellScanner cells, Throwab
}
}
bc = new BufferChain(responseBufs);
if (connection.useWrap) {
bc = wrapWithSasl(bc);
}
} catch (IOException e) {
RpcServer.LOG.warn("Exception while creating response " + e);
}
Expand Down Expand Up @@ -547,6 +544,20 @@ public int getRemotePort() {

@Override
public synchronized BufferChain getResponse() {
return response;
if (connection.useWrap) {
/*
* wrapping result with SASL as the last step just before sending it out, so
* every message must have the right increasing sequence number
*/
try {
return wrapWithSasl(response);
} catch (IOException e) {
/* it is exactly the same what setResponse() does */
RpcServer.LOG.warn("Exception while creating response " + e);
return null;
}
} else {
return response;
}
}
}

0 comments on commit 1c49ffd

Please sign in to comment.