Tokio service endless loop

Hi,

I am playing around with tokio service building a simple http server.
I have a service like the following:

impl Service for InternalServer {
    type Request = DecodingResult;
    type Response = Response<Body>;
    type Error = io::Error;
    type Future = future::Ok<Self::Response, io::Error>;

    fn call(&self, req: DecodingResult) -> Self::Future {
        let (req, handler, params) = match req {
            DecodingResult::BodyTooLarge => return future::ok(HttpError::bad_request("Request too large").into()),
            DecodingResult::HeaderTooLarge => return future::ok(HttpError::bad_request("Header too large").into()),
            DecodingResult::RouteNotFound => return future::ok(HttpError::not_found(Some("Route not found")).into()),
            DecodingResult::Ok(res) => res
        };
        println!("Endless loop");
        future::ok(HttpError::not_found(Some("Route not found")).into())
    }
}

If I get a http request to a not found route everything behaves normal and I get a valid response on my client.
However if I get a valid request/route combination and return the 2nd future, tokio will run this in an endless loop.
I don't get the difference here and any help is greatly appreciated.

If you want to run it use the following:

git clone https://github.com/krampenschiesser/rest_in_rust.git
cd rest_in_rust/
git reset --hard a8eeba2eb19dd595aa7517259288ff72f64fd414
cargo run --example helloworld &
curl http://localhost:8091/hello/world

Thank you for reading this!

Btw: I am using

rustc 1.21.0-nightly (7ac979d8c 2017-08-16)
tokio-io 0.1.3
tokio-proto 0.1.1
tokio-service 0.1.0
tokio-tls 0.1.3

What is that future::Ok type? AFAIK, future::ok(...) returns a future::FutureResult. Curious what that is.

If anybody finds this again, the reason for the endless loop was not clearing/splitting the buffer.
So buffer was kept full and therefore an endless loop happened.