fix(BinaryLogClient): use writeBuffered exclusively & adjust packetNum for SSL switch auth #274
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The changes introduced in #272 by @osheroff were not quite enough for me to connect to Azure MySQL. Testing against two different Azure MySQL DB's, I found that we needed to use PacketChannel#writeBuffered for each command.
Additionally, for connections using an SSL socket, the packet number needed to be doubly incremented in between the AuthenticateCommand packet and the AuthenticateNativePasswordCommand packet. This is presumably because of an implicit SSL packet being sent by the socket before the issuing of the AuthenticateNativePasswordCommand packet.
I've tested against standard MySQL databases versions (5.7) and found no problems exclusively using PacketChannel#writeBuffer both with/without SSL. I'll test it out with a few other versions and report back. @shyiko, do you anticipate any issues using PacketChannel#writeBuffer in the general case?