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

SSL hang / timeout fix #73

Merged
merged 2 commits into from
Feb 14, 2020

Conversation

jentfoo
Copy link
Member

@jentfoo jentfoo commented Feb 13, 2020

This fixes ssl, which can be seen using litesockets-http-client when using https. The behavior would be the start of the handshake which would eventually hang.
This regression was introduced in this PR: #71
The specific flaw was introduced when the .duplicate() was removed here: https://github.com/threadly/litesockets/pull/71/files#diff-851d3597731b2cecc83331ede7aec7ebL143

It seems for SSL to work correctly we need to make sure that the MergedByteBuffer does not work against the original ByteBuffer that was originally passed in.
This fixes that behavior by making sure that when ByteBuffers are added (or provided at construction), we do this .duplicate() then. This way when buffers are leaving the MergedByteBuffer we know it already has an independent experience from the one provided initially. The goal being that by having this duplicate action happen at a consistent point will make this safer.
Overall I don't think we really add any .duplicate() actions, if anything at times we might have less. With it happening at the start we can safely avoid duplicate calls at other points we had them previously.

This fixes ssl, which can be seen using litesockets-http-client when using https.  The behavior would be the start of the handshake which would eventually hang.
This regression was introduced in this PR: threadly#71
The specific flaw was introduced when the .duplicate() was removed here: https://github.com/threadly/litesockets/pull/71/files#diff-851d3597731b2cecc83331ede7aec7ebL143

It seems for SSL to work correctly we need to make sure that the MergedByteBuffer does not work against the original ByteBuffer that was originally passed in.
This fixes that behavior by making sure that when ByteBuffers are added (or provided at construction), we do this .duplicate() then.  This way when buffers are leaving the MergedByteBuffer we know it already has an independent experience from the one provided initially.  The goal being that by having this duplicate action happen at a consistent point will make this safer.
Overall I don't think we really add any .duplicate() actions, if anything at times we might have less.  With it happening at the start we can safely avoid duplicate calls at other points we had them previously.
@jentfoo jentfoo merged commit 400e504 into threadly:master Feb 14, 2020
@jentfoo jentfoo deleted the MergedByteBuffers-duplicate_fix branch February 14, 2020 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants