Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ All notable changes to this project will be documented in this file.

- Deprecated `SharedState::new` (since 0.2.0); construct via `inner.into()`
instead.
- Breaking: Marked `ServerError` as `#[non_exhaustive]`. Downstream consumers
must add a wildcard arm when matching it.
5 changes: 2 additions & 3 deletions src/server/config/binding.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Binding configuration for [`WireframeServer`].

use core::marker::PhantomData;
use std::{
net::{SocketAddr, TcpListener as StdTcpListener},
sync::Arc,
Expand Down Expand Up @@ -92,7 +91,7 @@ where
state: Bound {
listener: Arc::new(tokio),
},
_preamble: PhantomData,
_preamble: self._preamble,
})
}
}
Expand Down Expand Up @@ -177,7 +176,7 @@ where
state: Bound {
listener: Arc::new(tokio),
},
_preamble: PhantomData,
_preamble: self._preamble,
})
}
}
1 change: 1 addition & 0 deletions src/server/config/preamble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ where
/// Register a handler invoked when the connection preamble decodes successfully.
///
/// The handler must implement [`crate::server::PreambleSuccessHandler`].
/// See [`crate::server::PreambleHandler`] for a ready-to-use alias.
///
/// # Examples
///
Expand Down
7 changes: 6 additions & 1 deletion src/server/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ async fn process_stream<F, T>(
if let Some(handler) = on_success.as_ref()
&& let Err(e) = handler(&preamble, &mut stream).await
{
tracing::error!(error = ?e, ?peer_addr, "preamble handler error");
tracing::error!(
error = %e,
error_debug = ?e,
?peer_addr,
"preamble handler error",
);
}
let stream = RewindStream::new(leftover, stream);
let app = (factory)();
Expand Down
1 change: 1 addition & 0 deletions src/server/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::io;
use thiserror::Error;

/// Errors that may occur while configuring or running the server.
#[non_exhaustive]
Comment thread
leynos marked this conversation as resolved.
#[derive(Debug, Error)]
pub enum ServerError {
/// Binding or configuring the listener failed.
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<T, F> PreambleSuccessHandler<T> for F where
{
}

/// Handler invoked when a connection preamble decodes successfully.
/// [`PreambleSuccessHandler`] wrapped in `Arc`.
pub type PreambleHandler<T> = Arc<dyn PreambleSuccessHandler<T>>;

/// Handler invoked when decoding a connection preamble fails.
Expand Down
Loading