Skip to content

Commit 05689b8

Browse files
authored
Remove Option wrapper for CounterGuard (#313)
1 parent fd3e5fb commit 05689b8

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

actix-server/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl ServiceRuntime {
243243

244244
type BoxedNewService = Box<
245245
dyn BaseServiceFactory<
246-
(Option<CounterGuard>, MioStream),
246+
(CounterGuard, MioStream),
247247
Response = (),
248248
Error = (),
249249
InitError = (),
@@ -257,7 +257,7 @@ struct ServiceFactory<T> {
257257
inner: T,
258258
}
259259

260-
impl<T> BaseServiceFactory<(Option<CounterGuard>, MioStream)> for ServiceFactory<T>
260+
impl<T> BaseServiceFactory<(CounterGuard, MioStream)> for ServiceFactory<T>
261261
where
262262
T: BaseServiceFactory<TcpStream, Config = ()>,
263263
T::Future: 'static,

actix-server/src/service.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) trait InternalServiceFactory: Send {
2929

3030
pub(crate) type BoxedServerService = Box<
3131
dyn Service<
32-
(Option<CounterGuard>, MioStream),
32+
(CounterGuard, MioStream),
3333
Response = (),
3434
Error = (),
3535
Future = Ready<Result<(), ()>>,
@@ -50,7 +50,7 @@ impl<S, I> StreamService<S, I> {
5050
}
5151
}
5252

53-
impl<S, I> Service<(Option<CounterGuard>, MioStream)> for StreamService<S, I>
53+
impl<S, I> Service<(CounterGuard, MioStream)> for StreamService<S, I>
5454
where
5555
S: Service<I>,
5656
S::Future: 'static,
@@ -65,7 +65,7 @@ where
6565
self.service.poll_ready(ctx).map_err(|_| ())
6666
}
6767

68-
fn call(&self, (guard, req): (Option<CounterGuard>, MioStream)) -> Self::Future {
68+
fn call(&self, (guard, req): (CounterGuard, MioStream)) -> Self::Future {
6969
ready(match FromStream::from_mio(req) {
7070
Ok(stream) => {
7171
let f = self.service.call(stream);

actix-server/src/worker.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ impl Future for ServerWorker {
461461
// handle incoming io stream
462462
Some(WorkerCommand(msg)) => {
463463
let guard = self.conns.get();
464-
let _ = self.services[msg.token.0]
465-
.service
466-
.call((Some(guard), msg.io));
464+
let _ = self.services[msg.token.0].service.call((guard, msg.io));
467465
}
468466
None => return Poll::Ready(()),
469467
};

0 commit comments

Comments
 (0)