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

Summary of changes in this commit: #18

Merged
merged 4 commits into from
Apr 11, 2023
Merged

Summary of changes in this commit: #18

merged 4 commits into from
Apr 11, 2023

Conversation

quinnj
Copy link
Member

@quinnj quinnj commented Apr 11, 2023

  • Factor ERR_clear_error into its own function and call in the geterror macro right before we do SSL IO operations; the openssl docs recommend this and trying to keep your error stack as clean as possible
  • Add :acquire/:release memory orderings to our atomic operations; shouldn't make that big of a difference, but more semantically correct with how we define our atomicget/atomicset macros
  • Instead of call eof(ssl) before each SSL_read_ex call, we instead only check that the ssl is open, then optimistically call SSL_read_ex; if there are buffered bytes, they'll be processed and we saved ourselves an eof call; if SSL_read_ex returns SSL_WANT_READ, then we'll call eof anyway afterwards
  • Remove the finalizer on our SSL struct; @kpamnany recommended avoiding finalizers and we already have really well defined create/destroy moments for SSLs, so we don't need to be messing w/ the global finalizer list
  • Remove 2 update_tls_error_state calls in SSL_pending and SSL_has_pending; these aren't needed because the openssl documentation mentions specifically these don't use the same error reporting as IO functions
  • Also tweaked our eof call to avoid allocating a Ref{UInt8} each time it is called

  * Factor ERR_clear_error into its own function and call in the geterror macro right before we do SSL IO operations;
    the openssl docs recommend this and trying to keep your error stack as clean as possible
  * Add :acquire/:release memory orderings to our atomic operations; shouldn't make that big of a difference, but
    more semantically correct with how we define our atomicget/atomicset macros
  * Instead of call `eof(ssl)` before each SSL_read_ex call, we instead only check that the ssl is open, then
    optimistically call SSL_read_ex; if there are buffered bytes, they'll be processed and we saved ourselves
    an `eof` call; if SSL_read_ex returns SSL_WANT_READ, then we'll call `eof` anyway afterwards
  * Remove the finalizer on our SSL struct; @kpamnany recommended avoiding finalizers and we already have really
    well defined create/destroy moments for SSLs, so we don't need to be messing w/ the global finalizer list
  * Remove 2 `update_tls_error_state` calls in SSL_pending and SSL_has_pending; these aren't needed because
    the openssl documentation mentions specifically these don't use the same error reporting as IO functions
  * Also tweaked our eof call to avoid allocating a Ref{UInt8} each time it is called
@codecov-commenter
Copy link

codecov-commenter commented Apr 11, 2023

Codecov Report

Merging #18 (a3b42c6) into main (e03e6c4) will decrease coverage by 0.09%.
The diff coverage is 88.23%.

@@            Coverage Diff             @@
##             main      #18      +/-   ##
==========================================
- Coverage   75.78%   75.70%   -0.09%     
==========================================
  Files           2        2              
  Lines        1049     1062      +13     
==========================================
+ Hits          795      804       +9     
- Misses        254      258       +4     
Impacted Files Coverage Δ
src/ssl.jl 75.74% <87.09%> (-0.60%) ⬇️
src/OpenSSL.jl 75.69% <100.00%> (+0.05%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

quinnj and others added 2 commits April 11, 2023 10:02
Co-authored-by: Nick Robinson <[email protected]>
Co-authored-by: Nick Robinson <[email protected]>
Co-authored-by: Nick Robinson <[email protected]>
@quinnj
Copy link
Member Author

quinnj commented Apr 11, 2023

Thanks for the great review + suggestions @nickrobinson251; GitHub was being super weird and the UI wasn't working very well, so I managed to commit a few of your changes and made the others locally and pushed. Should be all addressed now!

Copy link
Contributor

@nickrobinson251 nickrobinson251 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is my first time reviewing on this package, but the changes make sense to me

I think ideally we'd have higher test coverage on this repo -- maybe we can open an issue about that?

@quinnj
Copy link
Member Author

quinnj commented Apr 11, 2023

Yeah, that's a good point. And honestly, the easiest part is probably just removing most of the code in the OpenSSL.jl file, since we don't really use it/depend on it for the SSLStream stuff. I've opened this issue to follow up on that.

@quinnj quinnj merged commit 0d7140a into main Apr 11, 2023
@quinnj quinnj deleted the jq-work branch April 11, 2023 20:06
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.

3 participants