Skip to content

Commit 47d1844

Browse files
committed
Send SASL message when state is Finished(Yes)
This was a bug in the existing implementation that sometimes caused issues, but that some kafka brokers appear to tolerate.
1 parent 493d791 commit 47d1844

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/messenger.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,12 +605,14 @@ where
605605
loop {
606606
let mut to_sent = Cursor::new(Vec::new());
607607
let state = session.step(data_received.as_deref(), &mut to_sent)?;
608-
if !state.is_running() {
608+
609+
if state.has_sent_message() {
610+
let authentication_response =
611+
self.sasl_authentication(to_sent.into_inner()).await?;
612+
data_received = Some(authentication_response.auth_bytes.0);
613+
} else {
609614
break;
610615
}
611-
612-
let authentication_response = self.sasl_authentication(to_sent.into_inner()).await?;
613-
data_received = Some(authentication_response.auth_bytes.0);
614616
}
615617

616618
Ok(())

0 commit comments

Comments
 (0)