Skip to content

Commit

Permalink
Update service.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn committed Sep 21, 2022
1 parent cf27ca5 commit 707d264
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions core/src/service.rs
Expand Up @@ -111,9 +111,9 @@ impl Service {

#[doc(hidden)]
#[inline]
pub fn hyper_handler(&self) -> HyperHandler {
pub fn hyper_handler(&self, remote_addr: Option<SocketAddr>) -> HyperHandler {
HyperHandler {
remote_addr: None,
remote_addr,
router: self.router.clone(),
catchers: self.catchers.clone(),
allowed_media_types: self.allowed_media_types.clone(),
Expand Down Expand Up @@ -143,7 +143,7 @@ impl Service {
/// ```
#[inline]
pub async fn handle(&self, request: impl Into<Request>) -> Response {
self.hyper_handler().handle(request.into()).await
self.hyper_handler(None).handle(request.into()).await
}
}
impl<'t, T> hyper::service::Service<&'t T> for Service
Expand All @@ -163,8 +163,7 @@ where

#[inline]
fn call(&mut self, target: &T) -> Self::Future {
let remote_addr = target.remote_addr();
future::ok(self.hyper_handler())
future::ok(self.hyper_handler(target.remote_addr()))
}
}

Expand Down

0 comments on commit 707d264

Please sign in to comment.