Skip to content

Commit

Permalink
Merge pull request AlexPikalov#299 from NunuM/master
Browse files Browse the repository at this point in the history
AlexPikalov#296 Removed the extra 4 bytes from the auth response
  • Loading branch information
AlexPikalov authored Dec 19, 2019
2 parents a33fdf4 + 39205f1 commit 4e09189
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cluster/tcp_connection_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ pub fn startup<'b, T: CDRSTransport + 'static, A: Authenticator + 'static + Size
return Err(err);
}

let auth_token_bytes = session_authenticator.get_auth_token().into_cbytes();
let auth_token_bytes = session_authenticator.get_auth_token();
transport.borrow_mut().write(
Frame::new_req_auth_response(auth_token_bytes)
.into_cbytes()
Expand Down
6 changes: 3 additions & 3 deletions src/frame/frame_auth_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ impl IntoBytes for BodyReqAuthResponse {

impl Frame {
/// Creates new frame of type `AuthResponse`.
pub fn new_req_auth_response(bytes: Vec<u8>) -> Frame {
pub fn new_req_auth_response(token_bytes: CBytes) -> Frame {
let version = Version::Request;
let flag = Flag::Ignore;
let stream = rand::random::<u16>();
let opcode = Opcode::AuthResponse;
let body = BodyReqAuthResponse::new(CBytes::new(bytes));
let body = BodyReqAuthResponse::new(token_bytes);

Frame {
version: version,
Expand Down Expand Up @@ -60,7 +60,7 @@ mod tests {
#[test]
fn frame_body_req_auth_response() {
let bytes = vec![1, 2, 3];
let frame = Frame::new_req_auth_response(bytes);
let frame = Frame::new_req_auth_response(CBytes::new(bytes));

assert_eq!(frame.version, Version::Request);
assert_eq!(frame.flags, vec![Flag::Ignore]);
Expand Down

0 comments on commit 4e09189

Please sign in to comment.