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

fix(transport): Make Server::layer() support more than one layer #932

Merged
merged 2 commits into from Mar 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions tonic/src/transport/server/mod.rs
Expand Up @@ -54,7 +54,10 @@ use std::{
};
use tokio::io::{AsyncRead, AsyncWrite};
use tower::{
layer::util::Identity, layer::Layer, limit::concurrency::ConcurrencyLimitLayer, util::Either,
layer::util::{Identity, Stack},
layer::Layer,
limit::concurrency::ConcurrencyLimitLayer,
util::Either,
Service, ServiceBuilder,
};

Expand Down Expand Up @@ -408,9 +411,9 @@ impl<L> Server<L> {
/// [eco]: https://github.com/tower-rs
/// [`ServiceBuilder`]: tower::ServiceBuilder
/// [interceptors]: crate::service::Interceptor
pub fn layer<NewLayer>(self, new_layer: NewLayer) -> Server<NewLayer> {
pub fn layer<NewLayer>(self, new_layer: NewLayer) -> Server<Stack<L, NewLayer>> {
Server {
layer: new_layer,
layer: Stack::new(self.layer, new_layer),
Arcterus marked this conversation as resolved.
Show resolved Hide resolved
trace_interceptor: self.trace_interceptor,
concurrency_limit: self.concurrency_limit,
timeout: self.timeout,
Expand Down