mirror of
https://github.com/telemt/telemt.git
synced 2026-10-11 20:05:58 +03:00
WEB Carriers negotiation and lane lifecycle bounds hardened
Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,14 @@ fn session_with_limits(limits: WebLimitsConfig) -> Arc<WebSession> {
|
||||
fn new_session(
|
||||
limits: WebLimitsConfig,
|
||||
manager: std::sync::Weak<WebProcessRuntime>,
|
||||
) -> Arc<WebSession> {
|
||||
new_session_with_automatic(limits, manager, false)
|
||||
}
|
||||
|
||||
fn new_session_with_automatic(
|
||||
limits: WebLimitsConfig,
|
||||
manager: std::sync::Weak<WebProcessRuntime>,
|
||||
automatic: bool,
|
||||
) -> Arc<WebSession> {
|
||||
let profile = Arc::new(WebRuntimeProfile {
|
||||
host: "proxy.example.com".to_string(),
|
||||
@@ -48,9 +56,13 @@ fn new_session(
|
||||
1,
|
||||
[3; 32],
|
||||
None,
|
||||
crate::web::manager::CarrierClientClass::Legacy,
|
||||
if automatic {
|
||||
crate::web::manager::CarrierClientClass::Bridge
|
||||
} else {
|
||||
crate::web::manager::CarrierClientClass::Legacy
|
||||
},
|
||||
None,
|
||||
false,
|
||||
automatic,
|
||||
limits,
|
||||
WebTimeoutsConfig::default(),
|
||||
)
|
||||
@@ -259,3 +271,20 @@ fn tombstone_eviction_releases_lane_budget_and_accepts_late_frames() {
|
||||
assert_eq!(session.process_up_lane(7, 7, &late), Ok(7));
|
||||
assert!(!session.state.lock().closed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn automatic_lane_does_not_ack_a_missing_lane_without_real_progress() {
|
||||
let session = new_session_with_automatic(
|
||||
WebLimitsConfig::default(),
|
||||
std::sync::Weak::new(),
|
||||
true,
|
||||
);
|
||||
let late = frame::encode(FrameType::Data, 7, b"late");
|
||||
|
||||
assert_eq!(
|
||||
session.process_up_lane(7, 1, &late),
|
||||
Err(ManagerError::Backpressure)
|
||||
);
|
||||
assert!(!session.is_carrier_committed());
|
||||
assert!(!session.state.lock().closed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user