Skip to content

Commit

Permalink
Fix debug cassandra message dump (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Aug 23, 2022
1 parent 79c181f commit a5d94e3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions shotover-proxy/src/codec/cassandra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ impl CassandraCodec {
impl CassandraCodec {
fn encode_raw(&mut self, item: CassandraFrame, dst: &mut BytesMut) {
let buffer = item.encode().encode_with(self.compressor).unwrap();
tracing::debug!(
"outgoing cassandra message:\n{}",
pretty_hex::pretty_hex(&buffer)
);
if buffer.is_empty() {
info!("trying to send 0 length frame");
}
Expand Down Expand Up @@ -124,11 +120,16 @@ impl Encoder<Messages> for CassandraCodec {
dst: &mut BytesMut,
) -> std::result::Result<(), Self::Error> {
for m in item {
let start = dst.len();
// TODO: always check if cassandra message
match m.into_encodable(MessageType::Cassandra)? {
Encodable::Bytes(bytes) => dst.extend_from_slice(&bytes),
Encodable::Frame(frame) => self.encode_raw(frame.into_cassandra().unwrap(), dst),
}
tracing::debug!(
"outgoing cassandra message:\n{}",
pretty_hex::pretty_hex(&&dst[start..])
);
}
Ok(())
}
Expand Down

0 comments on commit a5d94e3

Please sign in to comment.