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

Some thread-safety for writes #329

Merged
merged 7 commits into from
Dec 18, 2018
Merged

Some thread-safety for writes #329

merged 7 commits into from
Dec 18, 2018

Conversation

ocheron
Copy link
Contributor

@ocheron ocheron commented Dec 16, 2018

Completes the use of read lock / write lock to handle concurrent calls sending and receiving data.

Hopefully it will be enough to solve the issue raised in #323.

Calls to sendPacket/sendPacket13 are protected by the write lock to
make sure we never try to send two packets simultaneously.

In recvData, the use of the read lock is extended to the actual
processing of the packet just received.  This prevents another packet
to slip in before the full response is completed.
Merges processing of UpdateNotRequested and UpdateRequested together.
The latter has just a few more calls.
The library exposes things like ciphersuite_default, so we can assume
the underscore syntax is acceptable for the whole project.
The list of pending actions is always used with external
synchronization to make sure the actions are processed in the order
received.  So locking the list itself is not necessary.
Like all functions exposed by this module.
Copy link
Collaborator

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

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

It was very easy to review this PR since the test commit comes first.
Looks excellent to me.

kazu-yamamoto added a commit to kazu-yamamoto/hs-tls that referenced this pull request Dec 18, 2018
@kazu-yamamoto kazu-yamamoto merged commit ffbb978 into haskell-tls:master Dec 18, 2018
@kazu-yamamoto
Copy link
Collaborator

Merged.

@ocheron
Copy link
Contributor Author

ocheron commented Dec 18, 2018

Thanks for your review.

@ocheron ocheron deleted the thread-safety branch December 18, 2018 20:05
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.

None yet

2 participants