Skip to content
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

Don't send keep alive signals before kex is done #934

Merged

Conversation

hpoettker
Copy link
Contributor

@hpoettker hpoettker commented Mar 7, 2024

The PR should address #933.

@hpoettker hpoettker requested a review from hierynomus as a code owner March 7, 2024 10:10
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.16%. Comparing base (03f8b22) to head (f3954b8).
Report is 2 commits behind head on master.

❗ Current head f3954b8 differs from pull request most recent head cb3f4ee. Consider uploading reports for the commit cb3f4ee to get more accurate results

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #934      +/-   ##
============================================
+ Coverage     68.96%   69.16%   +0.19%     
- Complexity     1448     1454       +6     
============================================
  Files           208      208              
  Lines          7602     7604       +2     
  Branches        658      660       +2     
============================================
+ Hits           5243     5259      +16     
+ Misses         2009     1995      -14     
  Partials        350      350              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@derklaro
Copy link

derklaro commented Mar 8, 2024

I think there is a difference between waiting for conn.equals(conn.getTransport().getService()) and isKexDone: the first version also awaits the authentication process to complete, the new solution just waits for the key exchange. I guess it's better to just wait until the auth is done as well, before sending out keep alive messages 🤷

@hpoettker hpoettker force-pushed the no-keep-alive-before-kex-is-done branch from 8ba0d83 to 6b9d4ad Compare March 18, 2024 21:55
Otherwise, they could interfere with strict key exchange.
@hpoettker hpoettker force-pushed the no-keep-alive-before-kex-is-done branch from 6b9d4ad to f3954b8 Compare March 18, 2024 22:20
@hpoettker
Copy link
Contributor Author

I've added a reproducing test case to StrictKeyExchangeTest which uses a KeepAlive that sends heart beats instantantiouly after being started.

I've also relaxed the assertions in StrictKeyExchangeTest to prevent it from tripping on odd orders in the underlying concurrent processes.

The originally proposed changed should also work. But I've now made a simpler change, i.e. only starting the keep alive thread after the key exchange is done.

@hierynomus hierynomus merged commit 81d77d2 into hierynomus:master Apr 15, 2024
4 checks passed
@hierynomus
Copy link
Owner

Thanks for the PR!

@hpoettker hpoettker deleted the no-keep-alive-before-kex-is-done branch April 15, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants