stepancheg / grpc-rust

Rust implementation of gRPC
MIT License
1.37k stars 124 forks source link

Change server send mechanism to support trailing metadata #81

Closed bblancha closed 7 years ago

bblancha commented 7 years ago

Fixes #43 on the server side.

note: also changes the server api slightly, by adding parameters for trailing metadata

stepancheg commented 7 years ago

I've found another issue in PR: it does wait a couple of times. That is incorrect, because it makes stream blocking. I'm going to fix it myself now.

bblancha commented 7 years ago

Ok. I'm interested to see how you fix it.

For metadata_and_future_and_trailing_metadata(), we can use result.join(trailing). I can't figure out how to do it yet for stream_with_trailing() in stream_item::stream_with_trailing().

stepancheg commented 7 years ago

Committed as 1abb6afc9dc3a6a4c04455a46c7ce830b9734a0a. Thanks!

stepancheg commented 7 years ago

I can't figure out how to do it yet for stream_with_trailing() in stream_item::stream_with_trailing().

Simply by converting future into stream with into_stream operation:

        let stream = stream.map(ItemOrMetadata::Item);
        let trailing = trailing.map(ItemOrMetadata::TrailingMetadata).into_stream();
        GrpcStreamWithTrailingMetadata::new(stream.chain(trailing))