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

actix-codec: Support Half streams #453

Open
aviramha opened this issue Apr 4, 2022 · 2 comments
Open

actix-codec: Support Half streams #453

aviramha opened this issue Apr 4, 2022 · 2 comments

Comments

@aviramha
Copy link

aviramha commented Apr 4, 2022

Right now the codec supports only IO that has both AsyncRead and AsyncWrite.
I have a situation where the incoming codec != outgoing codec (different messages and I'd like to distinguish).
Ideally, I could use TcpStream::split() then create each half with a codec, but I can't do that because of both traits required.
I'm thinking we should add ReadFramed and WriteFramed to support that.

@asonix
Copy link
Contributor

asonix commented Apr 4, 2022

I'm also wondering if there is a specific reason that actix-codec is distinct from tokio-util::codec

@aviramha
Copy link
Author

aviramha commented Apr 4, 2022

I'm also wondering if there is a specific reason that actix-codec is distinct from tokio-util::codec

Ah! I didn't even notice it. TBH I solved it by creating 2 codecs, one for the "client" and other for the "server" which each one encodes/decodes different data.. not sure how elegant it is (prior solution was a generic codec)

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

No branches or pull requests

2 participants