You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
seanmonstar opened this issue
Aug 4, 2020
· 0 comments
· Fixed by #2387
Labels
A-bodyArea: body streaming.C-featureCategory: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.
The Body::channel() variant is a common simple way to send data as a Body. It would be useful to also be able to send trailers on it.
Implementation
The code to change is on the hyper::body::Sender, and the relevant Kind variant. I could imagine two possible ways to implement this, and I'm not sure which is better yet.
Change the internal mpsc channel to send enum Msg { Data(Bytes), Trailers(HeaderMap) }. However, the Kind::Chan variant would need to grow some cache slots, since poll_data could pop a Msg::Trailers, and then that would need to cached so that poll_trailers returns its.
Add a oneshot channel to send the trailers. The downside here is the increased size of Sender and Kind::Channel (they both are carrying an extra pointer), and the extra allocation.
I think the 2nd option is probably going to be better, but measurements are king. We should compare the changes to the benches/end_to_end results to see if the added feature makes much of a difference. If it does, we could consider making an internal "skinnier channel" that is used by the h1 dispatcher.
The text was updated successfully, but these errors were encountered:
seanmonstar
added
C-feature
Category: feature. This is adding a new feature.
E-medium
Effort: medium. Some knowledge of how hyper internal works would be useful.
A-body
Area: body streaming.
labels
Aug 4, 2020
A-bodyArea: body streaming.C-featureCategory: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.
The
Body::channel()
variant is a common simple way to send data as aBody
. It would be useful to also be able to send trailers on it.Implementation
The code to change is on the
hyper::body::Sender
, and the relevantKind
variant. I could imagine two possible ways to implement this, and I'm not sure which is better yet.enum Msg { Data(Bytes), Trailers(HeaderMap) }
. However, theKind::Chan
variant would need to grow some cache slots, sincepoll_data
could pop aMsg::Trailers
, and then that would need to cached so thatpoll_trailers
returns its.oneshot
channel to send the trailers. The downside here is the increased size ofSender
andKind::Channel
(they both are carrying an extra pointer), and the extra allocation.I think the 2nd option is probably going to be better, but measurements are king. We should compare the changes to the
benches/end_to_end
results to see if the added feature makes much of a difference. If it does, we could consider making an internal "skinnier channel" that is used by the h1 dispatcher.The text was updated successfully, but these errors were encountered: