-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Transport.isKeyExchangeRequired() to avoid unnecessary KEXINIT #811
Conversation
Codecov Report
@@ Coverage Diff @@
## master #811 +/- ##
============================================
- Coverage 64.71% 64.68% -0.03%
- Complexity 1459 1460 +1
============================================
Files 210 210
Lines 8519 8524 +5
Branches 778 779 +1
============================================
+ Hits 5513 5514 +1
- Misses 2601 2603 +2
- Partials 405 407 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@exceptionfactory 1 test failed, can you have a look? |
- Updated SSHClient.onConnect() to check isKeyExchangeRequired() before calling doKex() - Added started timestamp in ThreadNameProvider for improved tracking
f6eacf3
to
7446307
Compare
Thanks for the feedback @hierynomus! The test succeeded on a local build, but it appears to be an intermittent timing issue where the KeepAlive Thread may not have started. I pushed a new commit that moves the |
Merged! Thanks for the improvement |
Thank you very much @hierynomus! Are you planning to do a new release of SSHJ soon? This would be very helpful for downstream consumers, and the internal nature of the Transport changes make it difficult to patch around without upgrading. |
This pull request addresses SSH_MSG_UNIMPLEMENTED errors during key exchange described in issue #810.
Changes include adding
isKeyExchangeRequired()
to theTransport
interface, with an implementation inTransportImpl
that checks the status of Key Exchange completion and processing.Checking
KeyExchanger.isKexDone()
indicates that at least one key exchange has not been completed, and checkingKeyExchanger.isKexOngoing()
indicates that a key exchange is not in progress. CheckingTransport.isKeyExchangeRequired()
inSSHClient.onConnect()
avoids sending an additionalSSH_MSG_KEXINIT
packet when a key exchange is already in progress or completed.Additional changes include adding a started timestamp when setting a thread name in
ThreadNameProvider
. The started timestamp makes it easier to distinguished between threads for multiple connections to the same remote host and port.