fix(ztls): fix hanging handshake by running in goroutine#905
fix(ztls): fix hanging handshake by running in goroutine#905alsaibaiclaw wants to merge 1 commit intoprojectdiscovery:mainfrom
Conversation
WalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes #819
Problem
The
tlsHandshakeWithTimeoutfunction inpkg/tlsx/ztls/ztls.gowas running the handshake synchronously within theselectstatement. This prevented the context timeout from being checked while the handshake was in progress, causingtlsxto hang indefinitely on certain network conditions.Solution
Run the handshake in a separate goroutine and select between the error channel and the context timeout. This ensures the timeout is always respected.
Summary by CodeRabbit