rajinisivaram commented on code in PR #20258:
URL: https://github.com/apache/kafka/pull/20258#discussion_r2245453734


##########
clients/src/main/java/org/apache/kafka/common/security/authenticator/SaslServerAuthenticator.java:
##########
@@ -382,6 +382,12 @@ private void setSaslState(SaslState saslState, 
AuthenticationException exception
         } else {
             this.saslState = saslState;
             LOG.debug("Set SASL server state to {} during {}", saslState, 
reauthInfo.authenticationOrReauthenticationText());
+            if (saslState == SaslState.COMPLETE) {
+                // make sure that any pending write is actually sent.
+                if (reauthInfo.reauthenticating()) {
+                    transportLayer.addInterestOps(SelectionKey.OP_WRITE);

Review Comment:
   @omkreddy Instead of tracking write interest in the authenticator, we could 
add write interest in Selector when reauthentication completes 
[here](https://github.com/apache/kafka/blob/d0a9a04a0202f2ce6354fd72488aab665d046ee7/clients/src/main/java/org/apache/kafka/common/network/Selector.java#L552):
 
   
   In Selector we could add something like:
   ```
   channel.maybeAddWriteInterestAfterReauth();
   ```
   With a method in KafkaChannel:
   ```
   public void maybeAddWriteInterestAfterReauth() {
      if (send != null)
        this.transportLayer.addInterestOps(SelectionKey.OP_WRITE);
   }
   ```
   What do you think?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to