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

Add locks to Read and Write #64

Merged
merged 1 commit into from
Jul 31, 2020

Conversation

Ryanfsdf
Copy link
Collaborator

@Ryanfsdf Ryanfsdf commented Jul 31, 2020

Added locks to Read, Write, and Close.

These locks are needed to safely read, write, and close concurrently.


This change is Reviewable

Copy link
Owner

@matthewstevenson88 matthewstevenson88 left a comment

Choose a reason for hiding this comment

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

Thanks Ryan! Approved with 1 nit.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @matthewstevenson88 and @Ryanfsdf)


security/s2a/internal/record/record.go, line 162 at r1 (raw file):

	// hsAddr stores the address of the S2A handshaker service.
	hsAddr string
	// readMutex guards the Read implementation.

nit: s/the Read implementation/against concurrent calls to Read.

Similarly for the write mutex.

Copy link
Collaborator

@cesarghali cesarghali left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Collaborator

@cesarghali cesarghali left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Ryanfsdf)


security/s2a/internal/record/record.go, line 165 at r2 (raw file):

	// hsAddr stores the address of the S2A handshaker service.
	hsAddr string
	// readMutex guards against concurrent calls to Read.

Can you please add more info in the comment about why we need this mutex? Same for write. This way we can remember why we added them in the future.

Copy link
Collaborator Author

@Ryanfsdf Ryanfsdf left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @cesarghali)


security/s2a/internal/record/record.go, line 165 at r2 (raw file):

Previously, cesarghali (Cesar Ghali) wrote…

Can you please add more info in the comment about why we need this mutex? Same for write. This way we can remember why we added them in the future.

Done.

Copy link
Collaborator

@cesarghali cesarghali left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @cesarghali)

Copy link
Collaborator

@cesarghali cesarghali left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@Ryanfsdf Ryanfsdf merged commit 6c462b1 into matthewstevenson88:master Jul 31, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants