Index: Cargo.toml ================================================================== --- Cargo.toml +++ Cargo.toml @@ -1,8 +1,8 @@ [package] name = "lstngrp" -version = "0.0.4" +version = "0.0.5" edition = "2021" license = "0BSD" # https://crates.io/category_slugs categories = [ "network-programming", "asynchronous" ] keywords = [ "network", "server", "listen", "protwrap" ] @@ -22,12 +22,12 @@ # https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section [badges] maintenance = { status = "experimental" } [dependencies] -hashbrown = { version = "0.14.5" } -idbag = { version = "0.2.0" } +hashbrown = { version = "0.15.0" } +idbag = { version = "0.2.1" } killswitch = { version = "0.4.2" } parking_lot = { version = "0.12.3" } protwrap = { version = "0.3.0", features = [ "tls", "tokio" ] } Index: README.md ================================================================== --- README.md +++ README.md @@ -1,5 +1,5 @@ # lstngrp -`ListenerGroup` is meant to collect a group of network listeners into a single +`ListenGroup` is meant to collect a group of network listeners into a single entity, and help track connections made against those listeners. Index: examples/per_listener_ctx.rs ================================================================== --- examples/per_listener_ctx.rs +++ examples/per_listener_ctx.rs @@ -15,11 +15,11 @@ use parking_lot::Mutex; use hashbrown::HashMap; use lstngrp::{ - async_trait, ArcId, ConnHandler, ConnInfo, GroupHandler, ListenGroup, + async_trait, ArcIdUsize, ConnHandler, ConnInfo, GroupHandler, ListenGroup, Listener, ListenerSpec, SockAddr, Stream }; struct ListenCtx { name: String @@ -91,11 +91,11 @@ } struct MyConnHandler { listen_id: i64, - conn_id: ArcId + conn_id: ArcIdUsize } #[async_trait] impl ConnHandler for MyConnHandler { async fn run(&self, _conn: Stream) { Index: examples/simple.rs ================================================================== --- examples/simple.rs +++ examples/simple.rs @@ -1,9 +1,9 @@ use std::str::FromStr; use lstngrp::{ - async_trait, ArcId, ConnHandler, ConnInfo, GroupHandler, ListenGroup, + async_trait, ArcIdUsize, ConnHandler, ConnInfo, GroupHandler, ListenGroup, Listener, ListenerSpec, SockAddr, Stream }; struct MyHandler {} @@ -52,11 +52,11 @@ } struct MyConnHandler { listen_id: i64, - conn_id: ArcId + conn_id: ArcIdUsize } #[async_trait] impl ConnHandler for MyConnHandler { async fn run(&self, _conn: Stream) { Index: src/lib.rs ================================================================== --- src/lib.rs +++ src/lib.rs @@ -57,12 +57,13 @@ pub use protwrap::tokio::server::{ listener::{async_trait, Listener, SockAddr}, Stream }; -pub use idbag::ArcIdUsize as ArcId; -use idbag::IdBagUsize as IdBag; +pub use idbag::ArcIdUsize; + +use idbag::IdBagUsize; use conn::ConnectionData; use listener::{ListenData, ListenTaskParams}; @@ -79,11 +80,11 @@ pub struct ConnInfo { /// The connecting client's address. pub sa: Arc, /// The unique client connection id. - pub id: ArcId + pub id: ArcIdUsize } /// Group listener handler. #[async_trait] @@ -222,16 +223,16 @@ /// Keep track of all listeners, identified by `LI` and all their active /// connections, identified by an `ArcId`, with their connection context, /// identified by `CC`. lmap: Arc>>, - cmap: Arc>>>, + cmap: Arc>>>, /// Connection handler used by all the listeners within this group. lhandler: Arc>, - idbag: Arc, + idbag: Arc, shutdown: Arc } @@ -246,11 +247,11 @@ + Send + Sync + 'static ) -> Self { // ToDo: Allow this to be passed in from the application - let idbag = Arc::new(IdBag::new()); + let idbag = Arc::new(IdBagUsize::new()); Self { lmap: Arc::new(Mutex::new(HashMap::new())), lhandler: Arc::new(handler), cmap: Arc::new(Mutex::new(HashMap::new())), @@ -346,11 +347,11 @@ /// Terminate a connection given a connection identifier. /// /// This function will not return until the background connection task has /// terminated. - pub async fn kill_connection(&self, cid: ArcId) { + pub async fn kill_connection(&self, cid: ArcIdUsize) { // Extraction of join handle placed in a scope so that clippy doesn't think // the lock is held over an await point. let mut jh = { let mut cmap = self.cmap.lock(); let Some(cdata) = cmap.get_mut(&cid) else { @@ -447,12 +448,12 @@ /// Information returned about a connection when a listen group's current state /// is inspected. pub struct CInfo { /// The client connection's internal identifier. - pub id: ArcId, + pub id: ArcIdUsize, /// The client connection handler. pub chandler: Arc } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : Index: www/changelog.md ================================================================== --- www/changelog.md +++ www/changelog.md @@ -2,11 +2,34 @@ ⚠️ indicates a breaking change. ## [Unreleased] -[Details](/vdiff?from=lstngrp-0.0.3&to=trunk) +[Details](/vdiff?from=lstngrp-0.0.5&to=trunk) + +### Added + +### Changed + +### Removed + +--- + +## [0.0.5] - 2024-10-02 + +[Details](/vdiff?from=lstngrp-0.0.4&to=lstngrp-0.0.5) + +### Changed + +- No longer rename `ArcIdUsize` to `ArcId` for the export, because it turned + out to cause confusion. + +--- + +## [0.0.4] - 2024-09-20 + +[Details](/vdiff?from=lstngrp-0.0.3&to=lstngrp-0.0.4) ### Added - Support automatically closing connections when a listener is removed. Index: www/index.md ================================================================== --- www/index.md +++ www/index.md @@ -1,8 +1,8 @@ # lstngrp -`ListenerGroup` is meant to collect a group of network listeners into a single +`ListenGroup` is meant to collect a group of network listeners into a single entity, and help track connections made against those listeners. ## Change log