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

Avoid using deinit to fulfil the protocol negotiation promise #2497

Merged
merged 1 commit into from Aug 8, 2023

Conversation

FranzBusch
Copy link
Contributor

Motivation

Fixes #2494

Modification

This PR avoids using deinit to fulfil the protocol negotiation promise and opts to trap instead when it is being accessed before the handler is added. This allows us to use handlerAdded and handlerRemoved.

Result

No more deinit usage that can be observed.

@FranzBusch FranzBusch added the patch-version-bump-only For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1) label Aug 7, 2023
@FranzBusch FranzBusch requested a review from Lukasa August 7, 2023 14:01
Copy link
Member

@weissi weissi left a comment

Choose a reason for hiding this comment

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

nice, thanks

alpnCompleteHandler(result)
}
}

deinit {
switch self.stateMachine.deinitHandler() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we drop the deinitHandler method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes and the method is dropped from the state machine in this PR.

# Motivation

Fixes apple#2494

# Modification
This PR avoids using `deinit` to fulfil the protocol negotiation promise and opts to trap instead when it is being accessed before the handler is added. This allows us to use `handlerAdded` and `handlerRemoved`.

# Result
No more `deinit` usage that can be observed.
@Lukasa Lukasa merged commit cf28163 into apple:main Aug 8, 2023
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-version-bump-only For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1)
Projects
None yet
3 participants