1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-08-23 13:05:12 +02:00

refactor connection counter (#343)

* Remove restart_worker test

* Remove Slab

* Rework counter

* Make counter limit switch accurate

* Remove backpressure. Add pause state

* make changes for review

* fix doc comment for counter
This commit is contained in:
fakeshadow
2021-04-29 23:27:08 +08:00
committed by GitHub
parent 8ad5f58d38
commit e4d4ae21ee
6 changed files with 359 additions and 314 deletions

View File

@@ -26,28 +26,6 @@ use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
/// Socket ID token
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub(crate) struct Token(usize);
impl Default for Token {
fn default() -> Self {
Self::new()
}
}
impl Token {
fn new() -> Self {
Self(0)
}
pub(crate) fn next(&mut self) -> Token {
let token = Token(self.0);
self.0 += 1;
token
}
}
/// Start server building process
pub fn new() -> ServerBuilder {
ServerBuilder::default()