-
Notifications
You must be signed in to change notification settings - Fork 49
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
unsafe bytes #24
Comments
What IO library are you using? If it's |
Didn't know tokio used bytes. It's god because it's best reviewed but would be nice in the future to not rely on it maybe? But this is for the far future, not now. I guess it would be a library with the same API but that does deep copies on the calls, I don't know. |
my guess is that zero-copy is not a big deal for encoded packets cause they are small, or maybe most applications wouldn't need it. So lowering the attack surface would be great. By having a crate clone of the bytes library but that does copy instead of keeping a reference to a memory would be great. I really hate unsafe calls. Also, is it possible to make this crate independent of the async runtime? Because tokio does some unsafe trade-offs (like using bytes) for performance, so it can be used to process lots of requests, but for an rtsp client this is just not needed (for the majority of cases like an NVR with 16 cameras), I guess. |
It's already not zero-copy per se, more like "one copy", as discussed at #4. What Yes, it's possible to make this crate independent of the async runtime: support I don't need runtime independence, as my application is using tokio anyway. So it's also not at the top of my priority list. But this would make retina more widely usable, so I think it'd be worth doing. |
I see that you're using https://docs.rs/bytes/1.0.1/bytes/ for zero-copy, but it uses a lot of unsafe code. Shouldn't we at least give a feature option that swaps bytes by a safe version that does some copies? I'd prefer to use the safe version to minimize the amount of unsafe calls in my app.
I'm very concerned about this :(
The text was updated successfully, but these errors were encountered: