-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
framed with framed #1582
Comments
It doesn't sound like you need another |
First decoder can produce а BytesMut or [u8]. The problem is that the second codec needs to be changed some time ago to another. |
Do these shorter buffers each contain exactly one serialized struct? Exactly multiple? Or can these structs be fragmented across the buffers you are producing? |
First codec produce AES decodec chunks (1 chunk - 128 bytes). Second codec generate RPC query structure, which usually have length a several kbytes. The case with map/flatmap can not be applied in my case. |
I'd like to add that Nickolay is definitely not the only person with this kind of problem. My use case for this includes outer framing with error correction codes in 1032-byte frames (512 bytes of payload each) containing a byte stream of inner frames (not aligned to the outer ones and fragmented). IIRC, I've seen a few more people with this problem in the Tokio gitter channel. Decoder already provides an API for splitting the incoming byte stream (as an What's missing, IMHO, is either an adapter implementing AsyncRead over a |
I only find examples for sync adaptors: AES, Cryptostream, gzip. |
Big thanks! |
Version
tokio v0.1.22
Platform
Linux labor 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2 (2019-08-28) x86_64 GNU/Linux
Description
I'm writing my own TCP server. And I need stream encryption/decryption by AES. I wrote a codec, which can decrypt
TcpStream
and return decrypted buffer asFramed
object. After that I need to apply another codec for parse resulting buffer to packet struct. ButFramed
object can't use anotherFramed
as source of data (because doesn't implementAsyncRead
orAsyncWrite
traits). Is there a proper/idiomatic way to solve this problem?The text was updated successfully, but these errors were encountered: