mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 20:12:58 +01:00
Remove Option wrapper for CounterGuard (#313)
This commit is contained in:
parent
fd3e5fba02
commit
05689b86d9
@ -243,7 +243,7 @@ impl ServiceRuntime {
|
|||||||
|
|
||||||
type BoxedNewService = Box<
|
type BoxedNewService = Box<
|
||||||
dyn BaseServiceFactory<
|
dyn BaseServiceFactory<
|
||||||
(Option<CounterGuard>, MioStream),
|
(CounterGuard, MioStream),
|
||||||
Response = (),
|
Response = (),
|
||||||
Error = (),
|
Error = (),
|
||||||
InitError = (),
|
InitError = (),
|
||||||
@ -257,7 +257,7 @@ struct ServiceFactory<T> {
|
|||||||
inner: T,
|
inner: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> BaseServiceFactory<(Option<CounterGuard>, MioStream)> for ServiceFactory<T>
|
impl<T> BaseServiceFactory<(CounterGuard, MioStream)> for ServiceFactory<T>
|
||||||
where
|
where
|
||||||
T: BaseServiceFactory<TcpStream, Config = ()>,
|
T: BaseServiceFactory<TcpStream, Config = ()>,
|
||||||
T::Future: 'static,
|
T::Future: 'static,
|
||||||
|
@ -29,7 +29,7 @@ pub(crate) trait InternalServiceFactory: Send {
|
|||||||
|
|
||||||
pub(crate) type BoxedServerService = Box<
|
pub(crate) type BoxedServerService = Box<
|
||||||
dyn Service<
|
dyn Service<
|
||||||
(Option<CounterGuard>, MioStream),
|
(CounterGuard, MioStream),
|
||||||
Response = (),
|
Response = (),
|
||||||
Error = (),
|
Error = (),
|
||||||
Future = Ready<Result<(), ()>>,
|
Future = Ready<Result<(), ()>>,
|
||||||
@ -50,7 +50,7 @@ impl<S, I> StreamService<S, I> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<S, I> Service<(Option<CounterGuard>, MioStream)> for StreamService<S, I>
|
impl<S, I> Service<(CounterGuard, MioStream)> for StreamService<S, I>
|
||||||
where
|
where
|
||||||
S: Service<I>,
|
S: Service<I>,
|
||||||
S::Future: 'static,
|
S::Future: 'static,
|
||||||
@ -65,7 +65,7 @@ where
|
|||||||
self.service.poll_ready(ctx).map_err(|_| ())
|
self.service.poll_ready(ctx).map_err(|_| ())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(&self, (guard, req): (Option<CounterGuard>, MioStream)) -> Self::Future {
|
fn call(&self, (guard, req): (CounterGuard, MioStream)) -> Self::Future {
|
||||||
ready(match FromStream::from_mio(req) {
|
ready(match FromStream::from_mio(req) {
|
||||||
Ok(stream) => {
|
Ok(stream) => {
|
||||||
let f = self.service.call(stream);
|
let f = self.service.call(stream);
|
||||||
|
@ -461,9 +461,7 @@ impl Future for ServerWorker {
|
|||||||
// handle incoming io stream
|
// handle incoming io stream
|
||||||
Some(WorkerCommand(msg)) => {
|
Some(WorkerCommand(msg)) => {
|
||||||
let guard = self.conns.get();
|
let guard = self.conns.get();
|
||||||
let _ = self.services[msg.token.0]
|
let _ = self.services[msg.token.0].service.call((guard, msg.io));
|
||||||
.service
|
|
||||||
.call((Some(guard), msg.io));
|
|
||||||
}
|
}
|
||||||
None => return Poll::Ready(()),
|
None => return Poll::Ready(()),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user