Skip to content

Make sure that event loop of task is the same as event loop of channel #55

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

Merged
merged 1 commit into from
Jul 3, 2019
Merged

Conversation

t089
Copy link
Contributor

@t089 t089 commented Jun 27, 2019

As discussed in #54, currently if using a shared event loop group object to create a HTTPClient, the eventLoop property of the Channel will most likely not be the same as the eventLoop property of the Task. This can lead to a precondition failure, when the task delegate hops to the the task`s event loop.

This patch makes sure that both the task and the connection (channel) share the same event loop instance.

It also add a precondition on Task.setChannel(_:) to verify that the channel uses the same event loop as the task.

The provided test would trigger the precondition failure if the event loops would not match.

@swift-server-bot
Copy link

Can one of the admins verify this patch?

@weissi weissi requested review from artemredkin and Lukasa June 27, 2019 10:56
@artemredkin
Copy link
Collaborator

@swift-server-bot test this please

@artemredkin
Copy link
Collaborator

@t089 thanks for the patch! could you update HTTPClientTests+XCTest.swift for linux tests?

@t089
Copy link
Contributor Author

t089 commented Jul 1, 2019

@artemredkin I ran ./scripts/generate_linux_tests.rb

@artemredkin
Copy link
Collaborator

@swift-server-bot test this please

@artemredkin artemredkin requested a review from weissi July 1, 2019 10:05
@weissi
Copy link
Contributor

weissi commented Jul 3, 2019

@t089 sorry, there are conflicts now. We can merge this when they're fixed.

Copy link
Contributor

@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.

looks good, thank you!

@t089
Copy link
Contributor Author

t089 commented Jul 3, 2019

Thanks. Rebased on master.

@weissi
Copy link
Contributor

weissi commented Jul 3, 2019

wow that was quick, thanks so much @t089

@weissi weissi merged commit daf66bd into swift-server:master Jul 3, 2019
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.

4 participants