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

iOS waking up/radio problem with CRT #294

Closed
kneekey23 opened this issue Aug 4, 2021 · 3 comments
Closed

iOS waking up/radio problem with CRT #294

kneekey23 opened this issue Aug 4, 2021 · 3 comments

Comments

@kneekey23
Copy link
Contributor

kneekey23 commented Aug 4, 2021

The problem is with the socket layer specifically. The background is the single biggest battery hog on a mobile device is the cellular radio. The OS is incentivized to keep these radios off and minimize their usage. This implies a need for communication between the OS and the radio. Should we turn a radio.on for this or would the user be willing to wait? This is complicated even further by the fact that iOS is attempting to manage your battery by backgrounding apps. The ultimate problem becomes the socket bindings are not equipped for this kind of problem, they don't give enough abstractions to user space developers to communicate this info and have this back and forth awareness with the OS. It's worse with multipath for TCP. It's hard to express preferences in a useful way. you can have what looks like a working socket but the OS doesn't know you are trying to use or doesn't know you would rather wake up a radio to use it. This is more common when you background an app. You are not able to ensure that the cellular radio is gonna wake up and do the things you need them to do. To this end Apple shipped a higher level networking framework. It provides quite a few diff things but much of what it provides is how do we provide this extra semantic information to the dev and the phone. This allows connection attempts to be delayed until an appropriate networking channel comes up. Other things it can do is deal with the question of what kind of interface you want. That framework is the supported first party way to do networking on iOS. The socket layer is sort of deprecated on iOS but its not the right way to do things from a swift nio perspective we have a version of swift nio that uses networking instead.

Transport package below that do the swift nio things using Network Framework. https://github.com/apple/swift-nio-transport-services/tree/main/Sources

Tools to test: the network link conditioner is an additional tool for xcode and lets you fake out a bunch of diff network environments. There is no file descriptor on iOS.

There is really good network and dispatch queue documentation in the header files of the Network Framework

@kneekey23 kneekey23 self-assigned this Nov 5, 2021
@ganeshnj ganeshnj added the needs-triage This issue or PR still needs to be triaged. label Oct 4, 2022
@ganeshnj
Copy link
Contributor

The problem is not clear enough and we need to investigate the problem before we can solve.

@epau epau added this to the GA milestone Feb 23, 2023
@smivij
Copy link
Collaborator

smivij commented Dec 6, 2023

Related to awslabs/aws-crt-swift#211

@smivij smivij removed this from the GA milestone Mar 6, 2024
@smivij
Copy link
Collaborator

smivij commented Mar 7, 2024

Closing as duplicate of awslabs/aws-crt-swift#211

@smivij smivij closed this as completed Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants