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

Rewrite network stack to Swift NIO (armv7 support!) #68

Merged
merged 45 commits into from
Feb 11, 2019
Merged

Conversation

Bouke
Copy link
Owner

@Bouke Bouke commented Dec 15, 2018

The current network stack uses BlueSocket, which operates very directly on sockets, which means we have to build our own eventing mechanisms. Swift has seen the release of Swift NIO, an event-driven network application framework. Incorporating NIO means that we outsource a lot of the socket handling and eventing.

This PR incorporates a small portion of Vapor's HTTP handler, to parse the raw HTTP fields received from NIO.

The great thing about this rewrite, is that I'm finally able to run HAP on my Raspberry Pi3 (Stretch) on the community build of Swift 4.1.3.

This PR is not finished, there might be some cases that are not yet handled. I'm currently running this in my home to identify gaps, but so far seems to work like a charm. I plan on doing additional refactors to clean up, but maybe I'll leave that for a future PR.

Todo before merging:

  • Verify controller authorization
  • Verify pairing authorization role (in pairings())
  • Remove pairing + close connection
  • Re-enable all sync tests
  • Re-enable all async tests

@gbrooker
Copy link
Contributor

Why did HAP not run on the Pi before ? Is BlueSocket incompatible ?

@Bouke
Copy link
Owner Author

Bouke commented Dec 18, 2018 via email

This was referenced Jan 8, 2019
@Bouke Bouke merged commit 4041fa5 into master Feb 11, 2019
@Bouke Bouke deleted the swift-nio-http branch February 14, 2019 22: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

3 participants