1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

service trait takes shared self reference (#247)

This commit is contained in:
fakeshadow
2021-01-22 19:06:22 -08:00
committed by GitHub
parent 874e5f2e50
commit 636cef8868
27 changed files with 225 additions and 219 deletions

View File

@ -36,6 +36,7 @@ slab = "0.4"
tokio = { version = "1", features = ["sync"] }
[dev-dependencies]
actix-rt = "2.0.0-beta.2"
bytes = "1"
env_logger = "0.8"
futures-util = { version = "0.3.7", default-features = false, features = ["sink"] }

View File

@ -58,11 +58,11 @@ where
type Error = ();
type Future = Ready<Result<(), ()>>;
fn poll_ready(&mut self, ctx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
fn poll_ready(&self, ctx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.service.poll_ready(ctx).map_err(|_| ())
}
fn call(&mut self, (guard, req): (Option<CounterGuard>, MioStream)) -> Self::Future {
fn call(&self, (guard, req): (Option<CounterGuard>, MioStream)) -> Self::Future {
ready(match FromStream::from_mio(req) {
Ok(stream) => {
let f = self.service.call(stream);