mirror of
https://github.com/Noratrieb/icefun.git
synced 2026-01-15 21:25:02 +01:00
loop
This commit is contained in:
parent
189f24e53b
commit
944f82360f
34 changed files with 95 additions and 134 deletions
|
|
@ -4,18 +4,18 @@ use std::marker::PhantomData;
|
|||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::time::Duration;
|
||||
use bytes::{Buf, Bytes};
|
||||
use http::header::{HeaderValue, CONNECTION};
|
||||
|
||||
use http::{HeaderMap, Method, Version};
|
||||
use httparse::ParserConfig;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use tokio::time::Sleep;
|
||||
use tracing::{debug, error, trace};
|
||||
|
||||
use super::io::Buffered;
|
||||
use super::{Decoder, Encode, EncodedBuf, Encoder, Http1Transaction, ParseContext, Wants};
|
||||
use super::{Decoder, EncodedBuf, Encoder, Http1Transaction, Wants};
|
||||
use crate::body::DecodedLength;
|
||||
use crate::common::{task, Pin, Poll, Unpin};
|
||||
use crate::headers::connection_keep_alive;
|
||||
use crate::common::{task, Poll, Unpin};
|
||||
|
||||
use crate::proto::{BodyLength, MessageHead};
|
||||
const H2_PREFACE: &[u8] = b"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
|
||||
/// This handles a connection, which will have been established over an
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@ use std::error::Error as StdError;
|
|||
use bytes::{Buf, Bytes};
|
||||
use http::Request;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tracing::{debug, trace};
|
||||
use super::{Http1Transaction, Wants};
|
||||
use crate::body::{Body, DecodedLength, HttpBody};
|
||||
use tracing::{trace};
|
||||
use super::{Http1Transaction};
|
||||
use crate::body::{Body, HttpBody};
|
||||
use crate::common::{task, Future, Pin, Poll, Unpin};
|
||||
use crate::proto::{BodyLength, Conn, Dispatched, MessageHead, RequestHead};
|
||||
use crate::upgrade::OnUpgrade;
|
||||
use crate::proto::{Conn, Dispatched, MessageHead, RequestHead};
|
||||
|
||||
pub(crate) struct Dispatcher<D, Bs: HttpBody, I, T> {
|
||||
conn: Conn<I, Bs::Data, T>,
|
||||
dispatch: D,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::fmt;
|
|||
use std::io::IoSlice;
|
||||
use bytes::buf::{Chain, Take};
|
||||
use bytes::Buf;
|
||||
use tracing::trace;
|
||||
|
||||
use super::io::WriteBuf;
|
||||
type StaticBuf = &'static [u8];
|
||||
/// Encoders to handle different Transfer-Encodings.
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
use std::cmp;
|
||||
|
||||
use std::fmt;
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::future::Future;
|
||||
use std::io::{self, IoSlice};
|
||||
use std::marker::Unpin;
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use std::time::Duration;
|
||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use bytes::{Buf, Bytes, BytesMut};
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use tokio::time::Instant;
|
||||
use tracing::{debug, trace};
|
||||
|
||||
use super::{Http1Transaction, ParseContext, ParsedMessage};
|
||||
use crate::common::buf::BufList;
|
||||
use crate::common::{task, Pin, Poll};
|
||||
use crate::common::{task, Poll};
|
||||
/// The initial buffer size allocated before trying to read from IO.
|
||||
pub(crate) const INIT_BUFFER_SIZE: usize = 8192;
|
||||
/// The minimum value that can be set to max buffer size.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub(crate) use self::conn::Conn;
|
|||
pub(crate) use self::decode::Decoder;
|
||||
pub(crate) use self::dispatch::Dispatcher;
|
||||
pub(crate) use self::encode::{EncodedBuf, Encoder};
|
||||
pub(crate) use self::io::MINIMUM_MAX_BUFFER_SIZE;
|
||||
|
||||
mod conn;
|
||||
mod decode;
|
||||
pub(crate) mod dispatch;
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
use std::fmt::{self, Write};
|
||||
use std::fmt::{self};
|
||||
use std::mem::MaybeUninit;
|
||||
use bytes::Bytes;
|
||||
|
||||
use bytes::BytesMut;
|
||||
#[cfg(feature = "server")]
|
||||
use http::header::ValueIter;
|
||||
use http::header::{self, Entry, HeaderName, HeaderValue};
|
||||
use http::{HeaderMap, Method, StatusCode, Version};
|
||||
|
||||
use http::header::{HeaderName};
|
||||
use http::{HeaderMap, Method, StatusCode};
|
||||
#[cfg(all(feature = "server", feature = "runtime"))]
|
||||
use tokio::time::Instant;
|
||||
use tracing::{debug, error, trace, trace_span, warn};
|
||||
|
||||
use crate::body::DecodedLength;
|
||||
#[cfg(feature = "server")]
|
||||
use crate::common::date;
|
||||
|
||||
use crate::error::Parse;
|
||||
use crate::ext::HeaderCaseMap;
|
||||
#[cfg(feature = "ffi")]
|
||||
use crate::ext::OriginalHeaderOrder;
|
||||
use crate::headers;
|
||||
|
||||
use crate::proto::h1::{
|
||||
Encode, Encoder, Http1Transaction, ParseContext, ParseResult, ParsedMessage,
|
||||
Encode, Encoder, Http1Transaction, ParseContext, ParseResult,
|
||||
};
|
||||
use crate::proto::{BodyLength, MessageHead, RequestHead, RequestLine};
|
||||
const MAX_HEADERS: usize = 100;
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
use std::error::Error as StdError;
|
||||
#[cfg(feature = "runtime")]
|
||||
use std::time::Duration;
|
||||
use bytes::Bytes;
|
||||
|
||||
use futures_channel::{mpsc, oneshot};
|
||||
use futures_util::future::{self, Either, FutureExt as _, TryFutureExt as _};
|
||||
use futures_util::stream::StreamExt as _;
|
||||
|
||||
|
||||
use h2::client::{Builder, SendRequest};
|
||||
use h2::SendStream;
|
||||
use http::{Method, StatusCode};
|
||||
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tracing::{debug, trace, warn};
|
||||
use super::{ping, H2Upgraded, PipeToSendStream, SendBuf};
|
||||
|
||||
use super::{ping, SendBuf};
|
||||
use crate::body::HttpBody;
|
||||
use crate::client::dispatch::Callback;
|
||||
use crate::common::{exec::Exec, task, Future, Never, Pin, Poll};
|
||||
use crate::ext::Protocol;
|
||||
use crate::headers;
|
||||
use crate::proto::h2::UpgradedSendStream;
|
||||
|
||||
|
||||
|
||||
use crate::proto::Dispatched;
|
||||
use crate::upgrade::Upgraded;
|
||||
|
||||
use crate::{Body, Request, Response};
|
||||
use h2::client::ResponseFuture;
|
||||
type ClientRx<B> = crate::client::dispatch::Receiver<Request<B>, Response<Body>>;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
use bytes::{Buf, Bytes};
|
||||
use h2::{Reason, RecvStream, SendStream};
|
||||
use http::header::{HeaderName, CONNECTION, TE, TRAILER, TRANSFER_ENCODING, UPGRADE};
|
||||
use h2::{RecvStream, SendStream};
|
||||
|
||||
use http::HeaderMap;
|
||||
use pin_project_lite::pin_project;
|
||||
use std::error::Error as StdError;
|
||||
use std::io::{self, Cursor, IoSlice};
|
||||
use std::mem;
|
||||
|
||||
use std::task::Context;
|
||||
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
use crate::body::HttpBody;
|
||||
use crate::common::{task, Future, Pin, Poll};
|
||||
use crate::proto::h2::ping::Recorder;
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ use std::task::{self, Poll};
|
|||
use std::time::Duration;
|
||||
#[cfg(not(feature = "runtime"))]
|
||||
use std::time::Instant;
|
||||
use h2::{Ping, PingPong};
|
||||
use h2::{PingPong};
|
||||
#[cfg(feature = "runtime")]
|
||||
use tokio::time::{Instant, Sleep};
|
||||
use tracing::{debug, trace};
|
||||
|
||||
type WindowSize = u32;
|
||||
pub(super) fn disabled() -> Recorder {
|
||||
loop {}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,24 @@ use std::error::Error as StdError;
|
|||
use std::marker::Unpin;
|
||||
#[cfg(feature = "runtime")]
|
||||
use std::time::Duration;
|
||||
use bytes::Bytes;
|
||||
|
||||
use h2::server::{Connection, Handshake, SendResponse};
|
||||
use h2::{Reason, RecvStream};
|
||||
use http::{Method, Request};
|
||||
use h2::{RecvStream};
|
||||
|
||||
use pin_project_lite::pin_project;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
use tracing::{debug, trace, warn};
|
||||
|
||||
use super::{ping, PipeToSendStream, SendBuf};
|
||||
use crate::body::HttpBody;
|
||||
use crate::common::exec::ConnStreamExec;
|
||||
use crate::common::{date, task, Future, Pin, Poll};
|
||||
use crate::ext::Protocol;
|
||||
use crate::headers;
|
||||
use crate::common::{task, Future, Pin, Poll};
|
||||
|
||||
|
||||
use crate::proto::h2::ping::Recorder;
|
||||
use crate::proto::h2::{H2Upgraded, UpgradedSendStream};
|
||||
|
||||
use crate::proto::Dispatched;
|
||||
use crate::service::HttpService;
|
||||
use crate::upgrade::{OnUpgrade, Pending, Upgraded};
|
||||
use crate::upgrade::{Pending};
|
||||
use crate::{Body, Response};
|
||||
const DEFAULT_CONN_WINDOW: u32 = 1024 * 1024;
|
||||
const DEFAULT_STREAM_WINDOW: u32 = 1024 * 1024;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue