mirror of
https://github.com/telemt/telemt.git
synced 2026-10-31 04:50:35 +03:00
Rustfmt
This commit is contained in:
@@ -18,12 +18,8 @@ impl WebProcessRuntime {
|
||||
client_ip: IpAddr,
|
||||
public_addr: SocketAddr,
|
||||
) -> Result<u16, super::ManagerError> {
|
||||
let (result, notify) = self.try_acquire_stream_quiet(
|
||||
profile_key,
|
||||
max_streams,
|
||||
client_ip,
|
||||
public_addr,
|
||||
);
|
||||
let (result, notify) =
|
||||
self.try_acquire_stream_quiet(profile_key, max_streams, client_ip, public_addr);
|
||||
if let Some(notify) = notify {
|
||||
notify.notify_waiters();
|
||||
}
|
||||
@@ -94,12 +90,9 @@ impl WebProcessRuntime {
|
||||
public_addr: SocketAddr,
|
||||
peer_port: u16,
|
||||
) {
|
||||
if let Some(notify) = self.release_stream_quiet(
|
||||
profile_key,
|
||||
client_ip,
|
||||
public_addr,
|
||||
peer_port,
|
||||
) {
|
||||
if let Some(notify) =
|
||||
self.release_stream_quiet(profile_key, client_ip, public_addr, peer_port)
|
||||
{
|
||||
notify.notify_waiters();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,10 @@ fn quiet_queue_release_updates_accounting_before_notification_dispatch() {
|
||||
let waker = Waker::from(Arc::clone(&counter));
|
||||
let mut context = Context::from_waker(&waker);
|
||||
let mut notified = Box::pin(budget.notify.notified());
|
||||
assert!(matches!(notified.as_mut().poll(&mut context), Poll::Pending));
|
||||
assert!(matches!(
|
||||
notified.as_mut().poll(&mut context),
|
||||
Poll::Pending
|
||||
));
|
||||
|
||||
let notify = budget.release_queue_quiet([1; 32], 64, 1, false);
|
||||
|
||||
|
||||
@@ -117,9 +117,7 @@ impl WebProcessRuntime {
|
||||
return Err(ManagerError::Limit);
|
||||
}
|
||||
let global_capacity_full = state.bootstraps.len() >= self.limits.max_bootstraps_global;
|
||||
if global_capacity_full
|
||||
&& !state.bootstraps.values().any(|bootstrap| !bootstrap.used)
|
||||
{
|
||||
if global_capacity_full && !state.bootstraps.values().any(|bootstrap| !bootstrap.used) {
|
||||
self.record_limit_hit();
|
||||
self.telemetry
|
||||
.record_rejection(WebRejectionReason::BootstrapCapacity);
|
||||
|
||||
@@ -207,7 +207,10 @@ mod tests {
|
||||
let waker = Waker::from(Arc::clone(&counter));
|
||||
let mut context = Context::from_waker(&waker);
|
||||
let mut notified = Box::pin(admission.registrations_drained.notified());
|
||||
assert!(matches!(notified.as_mut().poll(&mut context), Poll::Pending));
|
||||
assert!(matches!(
|
||||
notified.as_mut().poll(&mut context),
|
||||
Poll::Pending
|
||||
));
|
||||
|
||||
let notify = registration.release_deferred().unwrap();
|
||||
|
||||
|
||||
@@ -92,7 +92,10 @@ async fn quiet_stream_release_returns_exact_post_accounting_drain_notification()
|
||||
let waker = Waker::from(Arc::clone(&counter));
|
||||
let mut context = Context::from_waker(&waker);
|
||||
let mut notified = Box::pin(runtime.operator_lifecycle.work_changed.notified());
|
||||
assert!(matches!(notified.as_mut().poll(&mut context), Poll::Pending));
|
||||
assert!(matches!(
|
||||
notified.as_mut().poll(&mut context),
|
||||
Poll::Pending
|
||||
));
|
||||
|
||||
let notify = runtime
|
||||
.release_stream_quiet(profile_key, client_ip, public_addr, peer_port)
|
||||
|
||||
@@ -40,18 +40,15 @@ impl WebProcessRuntime {
|
||||
.sessions
|
||||
.get(&replacement.old_session.token_hash())
|
||||
.is_some_and(|session| Arc::ptr_eq(session, &replacement.old_session));
|
||||
if !valid
|
||||
|| state.closed
|
||||
|| !state.issuance_enabled
|
||||
{
|
||||
if !valid || state.closed || !state.issuance_enabled {
|
||||
drop(state);
|
||||
self.cancel_replacement(bootstrap_hash, &replacement.old_session);
|
||||
return Err(ManagerError::Closed);
|
||||
}
|
||||
let Some(mut user_publication) = generation.proxy_shared.claim_authenticated_user(
|
||||
&replacement.profile.user,
|
||||
replacement.profile.credential_id,
|
||||
) else {
|
||||
let Some(mut user_publication) = generation
|
||||
.proxy_shared
|
||||
.claim_authenticated_user(&replacement.profile.user, replacement.profile.credential_id)
|
||||
else {
|
||||
drop(state);
|
||||
self.cancel_replacement(bootstrap_hash, &replacement.old_session);
|
||||
return Err(ManagerError::Closed);
|
||||
|
||||
Reference in New Issue
Block a user