mirror of
https://github.com/zerotier/zssp.git
synced 2026-05-22 16:28:40 -07:00
cargo fmt
This commit is contained in:
@@ -306,7 +306,10 @@ pub trait Sender {
|
||||
///
|
||||
/// Is implemented by `FnMut(&Arc<Session<Crypto>>) -> Option<(Sender, usize)>` closures.
|
||||
pub trait SendTo<Crypto: CryptoLayer> {
|
||||
type Sender<'a>: Sender where Crypto: 'a, Self: 'a;
|
||||
type Sender<'a>: Sender
|
||||
where
|
||||
Crypto: 'a,
|
||||
Self: 'a;
|
||||
/// Attempt to process and borrow the resources necessary to repeatedly send fragments of a
|
||||
/// packet to the given session.
|
||||
///
|
||||
|
||||
@@ -13,7 +13,7 @@ pub const MIN_TRANSPORT_MTU: usize = 128;
|
||||
/// the maximum transmission unit, that is passed to `Context::send`. Keep in mind that `mtu` must
|
||||
/// be above `MIN_TRANSPORT_MTU` or else `Context::send` would return `Err(SendError::MtuTooSmall).
|
||||
pub const fn max_sendable_len(mtu: usize) -> usize {
|
||||
(mtu - HEADER_SIZE)*MAX_FRAGMENTS - AES_GCM_TAG_SIZE
|
||||
(mtu - HEADER_SIZE) * MAX_FRAGMENTS - AES_GCM_TAG_SIZE
|
||||
}
|
||||
|
||||
pub(crate) const KID_SIZE: usize = 4;
|
||||
|
||||
+2
-10
@@ -625,11 +625,7 @@ impl<Crypto: CryptoLayer> Context<Crypto> {
|
||||
///
|
||||
/// * `app` - Interface to application using ZSSP
|
||||
/// * `send_to` - Function to get a sender and an MTU to send something over an active session
|
||||
pub fn service<App: ApplicationLayer<Crypto>>(
|
||||
&self,
|
||||
mut app: App,
|
||||
send_to: impl SendTo<Crypto>,
|
||||
) -> i64 {
|
||||
pub fn service<App: ApplicationLayer<Crypto>>(&self, mut app: App, send_to: impl SendTo<Crypto>) -> i64 {
|
||||
let current_time = app.time();
|
||||
let next_service_time = self.service_inner(app, send_to, current_time);
|
||||
let max_interval = Crypto::SETTINGS
|
||||
@@ -652,11 +648,7 @@ impl<Crypto: CryptoLayer> Context<Crypto> {
|
||||
///
|
||||
/// * `app` - Interface to application using ZSSP
|
||||
/// * `send_to` - Function to get a sender and an MTU to send something over an active session
|
||||
pub fn service_scheduled<App: ApplicationLayer<Crypto>>(
|
||||
&self,
|
||||
mut app: App,
|
||||
send_to: impl SendTo<Crypto>,
|
||||
) -> i64 {
|
||||
pub fn service_scheduled<App: ApplicationLayer<Crypto>>(&self, mut app: App, send_to: impl SendTo<Crypto>) -> i64 {
|
||||
let current_time = app.time();
|
||||
self.service_inner(app, send_to, current_time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user