Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/client/connect/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ where
{
async fn call_async(&mut self, dst: Uri) -> Result<TcpStream, ConnectError> {
trace!(
"Http::connect; scheme={:?}, host={:?}, port={:?}",
"Server::connect; scheme={:?}, host={:?}, port={:?}",
dst.scheme(),
dst.host(),
dst.port(),
Expand Down
22 changes: 10 additions & 12 deletions src/common/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Arc;

use crate::body::{Body, HttpBody};
use crate::proto::h2::server::H2Stream;
use crate::server::conn::spawn_all::{NewSvcTask, Watcher};
use crate::server::conn::spawn_all::SvcTask;
use crate::service::HttpService;

/// An executor of futures.
Expand All @@ -18,8 +18,8 @@ pub trait H2Exec<F, B: HttpBody>: Clone {
fn execute_h2stream(&mut self, fut: H2Stream<F, B>);
}

pub trait NewSvcExec<I, N, S: HttpService<Body>, E, W: Watcher<I, S, E>>: Clone {
fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>);
pub trait SvcExec<I, S: HttpService<Body>, E>: Clone {
fn execute_svc(&self, fut: SvcTask<I, S, E>);
}

pub type BoxSendFuture = Pin<Box<dyn Future<Output = ()> + Send>>;
Expand Down Expand Up @@ -74,13 +74,12 @@ where
}
}

impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for Exec
impl<I, S, E> SvcExec<I, S, E> for Exec
where
NewSvcTask<I, N, S, E, W>: Future<Output = ()> + Send + 'static,
SvcTask<I, S, E>: Future<Output = ()> + Send + 'static,
S: HttpService<Body>,
W: Watcher<I, S, E>,
{
fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>) {
fn execute_svc(&self, fut: SvcTask<I, S, E>) {
self.execute(fut)
}
}
Expand All @@ -98,14 +97,13 @@ where
}
}

impl<I, N, S, E, W> NewSvcExec<I, N, S, E, W> for E
impl<I, S, E> SvcExec<I, S, E> for E
where
E: Executor<NewSvcTask<I, N, S, E, W>> + Clone,
NewSvcTask<I, N, S, E, W>: Future<Output = ()>,
E: Executor<SvcTask<I, S, E>> + Clone,
SvcTask<I, S, E>: Future<Output = ()>,
S: HttpService<Body>,
W: Watcher<I, S, E>,
{
fn execute_new_svc(&mut self, fut: NewSvcTask<I, N, S, E, W>) {
fn execute_svc(&self, fut: SvcTask<I, S, E>) {
self.execute(fut)
}
}
14 changes: 5 additions & 9 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ pub(crate) enum Kind {
/// Error creating a TcpListener.
#[cfg(feature = "tcp")]
Listen,
/// Error accepting on an Incoming stream.
#[cfg(feature = "tcp")]
/// Error while accepting a new connection.
Accept,
/// Error while reading a body from connection.
Body,
Expand Down Expand Up @@ -67,8 +68,6 @@ pub(crate) enum Parse {
pub(crate) enum User {
/// Error calling user's HttpBody::poll_data().
Body,
/// Error calling user's MakeService.
MakeService,
/// Error from future of user's Service.
Service,
/// User tried to send a certain header in an unexpected context.
Expand Down Expand Up @@ -212,6 +211,7 @@ impl Error {
Error::new(Kind::Listen).with(cause)
}

#[cfg(feature = "tcp")]
pub(crate) fn new_accept<E: Into<Cause>>(cause: E) -> Error {
Error::new(Kind::Accept).with(cause)
}
Expand Down Expand Up @@ -268,10 +268,6 @@ impl Error {
Error::new_user(User::ManualUpgrade)
}

pub(crate) fn new_user_make_service<E: Into<Cause>>(cause: E) -> Error {
Error::new_user(User::MakeService).with(cause)
}

pub(crate) fn new_user_service<E: Into<Cause>>(cause: E) -> Error {
Error::new_user(User::Service).with(cause)
}
Expand Down Expand Up @@ -308,7 +304,8 @@ impl Error {
Kind::Canceled => "operation was canceled",
#[cfg(feature = "tcp")]
Kind::Listen => "error creating server listener",
Kind::Accept => "error accepting connection",
#[cfg(feature = "tcp")]
Kind::Accept => "error accepting a new connection",
Kind::Body => "error reading a body from connection",
Kind::BodyWrite => "error writing a body to connection",
Kind::BodyWriteAborted => "body write aborted",
Expand All @@ -317,7 +314,6 @@ impl Error {
Kind::Io => "connection error",

Kind::User(User::Body) => "error from user's HttpBody stream",
Kind::User(User::MakeService) => "error from user's MakeService",
Kind::User(User::Service) => "error from user's Service",
Kind::User(User::UnexpectedHeader) => "user sent unexpected header",
Kind::User(User::UnsupportedVersion) => "request has unsupported HTTP version",
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub const MINIMUM_MAX_BUFFER_SIZE: usize = INIT_BUFFER_SIZE;

/// The default maximum read buffer size. If the buffer gets this big and
/// a message is still not complete, a `TooLarge` error is triggered.
// Note: if this changes, update server::conn::Http::max_buf_size docs.
// Note: if this changes, update server::conn::Server::max_buf_size docs.
pub(crate) const DEFAULT_MAX_BUFFER_SIZE: usize = 8192 + 4096 * 100;

/// The maximum number of distinct `Buf`s to hold in a list before requiring
Expand Down
107 changes: 0 additions & 107 deletions src/server/accept.rs

This file was deleted.

Loading