Skip to content

Commit 005f73c

Browse files
authored
feat(rumqttd): Make Server public (#968)
* Make server public * Update changelog
1 parent 80a0ac7 commit 005f73c

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

rumqttd/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515
- Public re-export `Strategy` for shared subscriptions
16+
- Public export `Server` and `LinkType` so Server can be spawned on custom (or global) tokio runtime
1617
- Peer initiated disconnects logged as info rather than error.
1718
- External authentication function must be async
1819
- Update `tokio-rustls` to `0.25.0`, `rustls-webpki` to `0.102.1`, `tokio-native-tls` to `0.3.1` and

rumqttd/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ use tracing_subscriber::{
2121
pub use link::alerts;
2222
pub use link::local;
2323
pub use link::meters;
24-
pub use router::{Alert, Forward, IncomingMeter, Meter, Notification, OutgoingMeter};
24+
pub use router::{Alert, Forward, IncomingMeter, Meter, Notification, OutgoingMeter, Router};
2525
use segments::Storage;
26-
pub use server::Broker;
26+
pub use server::{Broker, LinkType, Server};
2727

2828
pub use self::router::shared_subs::Strategy;
2929

rumqttd/src/server/broker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ enum AwaitingWill {
344344
Fire,
345345
}
346346

347-
struct Server<P> {
347+
pub struct Server<P> {
348348
config: ServerSettings,
349349
router_tx: Sender<(ConnectionId, Event)>,
350350
protocol: P,
@@ -379,7 +379,7 @@ impl<P: Protocol + Clone + Send + 'static> Server<P> {
379379
Ok((Box::new(stream), None))
380380
}
381381

382-
async fn start(&mut self, link_type: LinkType) -> Result<(), Error> {
382+
pub async fn start(&mut self, link_type: LinkType) -> Result<(), Error> {
383383
let listener = TcpListener::bind(&self.config.listen).await?;
384384
let delay = Duration::from_millis(self.config.next_connection_delay_ms);
385385
let mut count: usize = 0;

rumqttd/src/server/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod broker;
44
#[cfg(any(feature = "use-rustls", feature = "use-native-tls"))]
55
mod tls;
66

7-
pub use broker::Broker;
7+
pub use broker::{Broker, LinkType, Server};
88

99
// pub trait IO: AsyncRead + AsyncWrite + Send + Sync + Unpin {}
1010
// impl<T: AsyncRead + AsyncWrite + Send + Sync + Unpin> IO for T {}

0 commit comments

Comments
 (0)