mirror of
https://github.com/Noratrieb/icefun.git
synced 2026-01-14 21:05:00 +01:00
loop
This commit is contained in:
parent
44a0230869
commit
dd3b3980bf
2 changed files with 9 additions and 20 deletions
|
|
@ -8,14 +8,13 @@ use crate::rt::Executor;
|
|||
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
|
||||
use crate::server::server::{new_svc::NewSvcTask, Watcher};
|
||||
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
|
||||
use crate::service::HttpService;
|
||||
use std::fmt;
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "server")]
|
||||
pub trait ConnStreamExec<F, B: HttpBody>: Clone {
|
||||
fn execute_h2stream(&mut self, fut: H2Stream<F, B>);
|
||||
pub trait ConnStreamExec<F, B>: Clone {
|
||||
fn execute_h2stream(&mut self);
|
||||
}
|
||||
#[cfg(all(feature = "server", any(feature = "http1", feature = "http2")))]
|
||||
pub trait NewSvcExec<I, S, E, W: Watcher<I, S, E>>: Clone {
|
||||
|
|
@ -39,7 +38,7 @@ where
|
|||
H2Stream<F, B>: Future<Output = ()> + Send + 'static,
|
||||
B: HttpBody,
|
||||
{
|
||||
fn execute_h2stream(&mut self, fut: H2Stream<F, B>) {
|
||||
fn execute_h2stream(&mut self) {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
|
@ -48,7 +47,6 @@ where
|
|||
impl<I, S, E, W> NewSvcExec<I, S, E, W> for Exec
|
||||
where
|
||||
NewSvcTask<I, S, E, W>: Future<Output = ()> + Send + 'static,
|
||||
S: HttpService<Body>,
|
||||
W: Watcher<I, S, E>,
|
||||
{
|
||||
fn execute_new_svc(&mut self, fut: NewSvcTask<I, S, E, W>) {
|
||||
|
|
@ -62,7 +60,7 @@ where
|
|||
H2Stream<F, B>: Future<Output = ()>,
|
||||
B: HttpBody,
|
||||
{
|
||||
fn execute_h2stream(&mut self, fut: H2Stream<F, B>) {
|
||||
fn execute_h2stream(&mut self) {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ impl<I, E> Builder<I, E> {
|
|||
}
|
||||
pub trait Watcher<I, S, E>: Clone {
|
||||
type Future;
|
||||
fn watch(&self) -> Self::Future;
|
||||
}
|
||||
#[allow(missing_debug_implementations)]
|
||||
#[derive(Copy, Clone)]
|
||||
|
|
@ -89,39 +88,31 @@ where
|
|||
S: HttpService<Body>,
|
||||
{
|
||||
type Future = ();
|
||||
fn watch(&self) -> Self::Future {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
pub(crate) mod new_svc {
|
||||
use super::Watcher;
|
||||
use crate::body::{Body, HttpBody};
|
||||
use crate::common::exec::ConnStreamExec;
|
||||
use crate::common::{task, Future, Pin, Poll, Unpin};
|
||||
use crate::common::{task, Future, Pin, Poll};
|
||||
use crate::service::HttpService;
|
||||
use std::error::Error as StdError;
|
||||
use tokio::io::{AsyncRead, AsyncWrite};
|
||||
|
||||
pub struct NewSvcTask<I, S, E, W: Watcher<I, S, E>> {
|
||||
state: State<I, S, E, W>,
|
||||
}
|
||||
|
||||
pub(super) enum State<I, S, E, W: Watcher<I, S, E>> {
|
||||
Connecting { a: (I, S, W, E) },
|
||||
|
||||
Connected { future: W::Future },
|
||||
pub(super) struct State<I, S, E, W: Watcher<I, S, E>> {
|
||||
a: (I, S, E),
|
||||
future: W::Future,
|
||||
}
|
||||
|
||||
impl<I, S: HttpService<Body>, E, W: Watcher<I, S, E>> NewSvcTask<I, S, E, W> {
|
||||
pub(super) fn new(watcher: W) -> Self {
|
||||
pub(super) fn new(_: W) -> Self {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
impl<I, S, B, E, W> Future for NewSvcTask<I, S, E, W>
|
||||
where
|
||||
S: HttpService<Body, ResBody = B>,
|
||||
B: HttpBody + 'static,
|
||||
B::Error: Into<Box<dyn StdError + Send + Sync>>,
|
||||
E: ConnStreamExec<S::Future, B>,
|
||||
W: Watcher<I, S, E>,
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue