Skip to content

Commit 16a0299

Browse files
authored
Fix: client reconnected every authenticationRefreshCheckSeconds when using tls authentication (#1062)
### Motivation When using pulsar tls authentication with a broker that sets the authenticationRefreshCheckSeconds the connection was dropped for each authentication refresh check. After analyzing logs and tcpdumps I concluded that this error appears because the tls authentication is returning null, witch does not pass a validation in the broker. After analyzing the tls auth implementation in Java (that works), I concluded that the GetData method should return empty byte array instead of nil. ### Modifications Changed tls auth GetData to return empty byte array instead of nil. --------- Co-authored-by: Jorge Pereira <[email protected]>
1 parent a3fcc9a commit 16a0299

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pulsar/internal/connection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,11 @@ func (c *connection) handleAuthChallenge(authChallenge *pb.CommandAuthChallenge)
823823
return
824824
}
825825

826+
// Brokers expect authData to be not nil
827+
if authData == nil {
828+
authData = []byte{}
829+
}
830+
826831
cmdAuthResponse := &pb.CommandAuthResponse{
827832
ProtocolVersion: proto.Int32(PulsarProtocolVersion),
828833
ClientVersion: proto.String(ClientVersionString),

0 commit comments

Comments
 (0)