Drop for PySSLSocket by youknowone · Pull Request #6791 · RustPython/RustPython
📝 Walkthrough
Walkthrough
A Drop implementation was added to PySSLSocket for resource cleanup upon drop, and shutdown behavior was modified so reads and writes error only after shutdown completion rather than blocking during state transitions.
Changes
| Cohort / File(s) | Summary |
|---|---|
SSL Socket Resource Management & Shutdown crates/stdlib/src/ssl.rs |
Added Drop trait implementation for PySSLSocket to clear connection state, pending TLS output, write buffering length, and reset shutdown state. Modified shutdown behavior to only error reads/writes after Completed state instead of blocking on any non-NotStarted state during transitions. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
- better ssl write handling #6763 — Directly related through Drop implementation and cleanup of PySSLSocket fields (connection state, pending_tls_output, write_buffered_len, shutdown_state)
- Share more ssl consts and fix openssl #6462 — Related through shutdown semantics changes and PySSLSocket behavior modifications
Poem
🐰 A rabbit hops through SSL's den,
With Drop to clean up now and then,
No leaks remain, no state astray,
Resources freed—hip-hop, hooray! 🎉
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title 'Drop for PySSLSocket' accurately describes the main change: implementing a Drop trait for the PySSLSocket type to handle resource cleanup. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
- 📝 Generate docstrings
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 @coderabbitai help to get the list of available commands and usage tips.