Skip to content

chore: refactor speaker & handshaker into actors #15

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 5 commits into from
Jan 6, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Dec 19, 2024

Instead of relying on class inheritance, the new Speaker can composed into whatever would like to speak the CoderVPN protocol, and messages can be handled by iterating over the speaker itself e.g:

enum IncomingMessage {
    case message(RecvMsg)
    case RPC(RPCRequest<SendMsg, RecvMsg>)
}
for try await msg in speaker {
    switch msg {
    case let .message(msg):
        // Handle message that doesn't require a response
    case let .RPC(req):
        // Handle incoming RPC
    }
}

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ethanndickson ethanndickson marked this pull request as ready for review December 19, 2024 07:35
Copy link
Member Author

ethanndickson commented Jan 6, 2025

Merge activity

  • Jan 6, 1:39 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 6, 1:39 AM EST: A user merged this pull request with Graphite.

@ethanndickson ethanndickson merged commit e9f5c6f into main Jan 6, 2025
4 checks passed
@ethanndickson ethanndickson deleted the ethan/speaker-actor branch January 6, 2025 06:39
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.

2 participants