Skip to content

Commit

Permalink
add support of a queue limit for incoming connections
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Sep 22, 2024
1 parent 4b92c3f commit ce509e9
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 168 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ bitflags = "2.6"
build-time = "0.1.3"
cfg-if = "1"
crossbeam-utils = { version = "0.8", default-features = false }
dyn-clone = "1.0"
fdt = { version = "0.1", features = ["pretty-printing"] }
free-list = "0.3"
fuse-abi = { version = "0.1", features = ["zerocopy"], optional = true }
Expand Down
10 changes: 2 additions & 8 deletions src/fd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use core::task::Poll::{Pending, Ready};
use core::time::Duration;

use async_trait::async_trait;
use dyn_clone::DynClone;
#[cfg(any(feature = "tcp", feature = "udp"))]
use smoltcp::wire::{IpEndpoint, IpListenEndpoint};

Expand Down Expand Up @@ -144,7 +143,7 @@ impl Default for AccessPermission {
}

#[async_trait]
pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug + DynClone {
pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug {
/// check if an IO event is possible
async fn poll(&self, _event: PollEvent) -> io::Result<PollEvent> {
Ok(PollEvent::empty())
Expand Down Expand Up @@ -187,7 +186,7 @@ pub(crate) trait ObjectInterface: Sync + Send + core::fmt::Debug + DynClone {

/// `accept` a connection on a socket
#[cfg(any(feature = "tcp", feature = "udp", feature = "vsock"))]
async fn accept(&self) -> io::Result<Endpoint> {
async fn accept(&self) -> io::Result<(Arc<dyn ObjectInterface>, Endpoint)> {
Err(io::Error::EINVAL)
}

Expand Down Expand Up @@ -398,11 +397,6 @@ pub(crate) fn insert_object(obj: Arc<dyn ObjectInterface>) -> io::Result<FileDes
block_on(core_scheduler().insert_object(obj), None)
}

#[allow(dead_code)]
pub(crate) fn replace_object(fd: FileDescriptor, obj: Arc<dyn ObjectInterface>) -> io::Result<()> {
block_on(core_scheduler().replace_object(fd, obj), None)
}

// The dup system call allocates a new file descriptor that refers
// to the same open file description as the descriptor oldfd. The new
// file descriptor number is guaranteed to be the lowest-numbered
Expand Down
Loading

0 comments on commit ce509e9

Please sign in to comment.