@@ -167,53 +167,14 @@ pub(crate) mod pipeline_debug {
167167 } )
168168 }
169169
170- pub fn push_event ( msg : String ) {
171- if let Ok ( mut g) = state ( ) . events . lock ( ) {
172- if g. len ( ) >= EVENT_CAP { g. pop_front ( ) ; }
173- g. push_back ( msg) ;
174- }
175- }
176-
177- pub fn set_limits ( max_elev : u64 , max_batches : u64 ) {
178- state ( ) . max_elevated . store ( max_elev, Ordering :: Relaxed ) ;
179- state ( ) . max_batch_slots . store ( max_batches, Ordering :: Relaxed ) ;
180- }
181-
182- pub fn set_elevated ( n : u64 ) {
183- state ( ) . elevated . store ( n, Ordering :: Relaxed ) ;
184- }
185-
186- pub fn batch_acquire ( ) {
187- state ( ) . active_batches . fetch_add ( 1 , Ordering :: Relaxed ) ;
188- }
189-
190- pub fn batch_release ( ) {
191- state ( ) . active_batches . fetch_sub ( 1 , Ordering :: Relaxed ) ;
192- }
193-
194- pub fn session_start ( sid : & str ) {
195- state ( ) . active_sessions . fetch_add ( 1 , Ordering :: Relaxed ) ;
196- if let Ok ( mut g) = state ( ) . sessions . lock ( ) {
197- g. insert ( sid[ ..sid. len ( ) . min ( 8 ) ] . to_string ( ) , SessionInfo { depth : 2 , inflight : 0 , elevated : false } ) ;
198- }
199- }
200-
201- pub fn session_end ( sid : & str ) {
202- state ( ) . active_sessions . fetch_sub ( 1 , Ordering :: Relaxed ) ;
203- if let Ok ( mut g) = state ( ) . sessions . lock ( ) {
204- g. remove ( & sid[ ..sid. len ( ) . min ( 8 ) ] ) ;
205- }
206- }
207-
208- pub fn session_update ( sid : & str , depth : usize , inflight : usize , elevated : bool ) {
209- if let Ok ( mut g) = state ( ) . sessions . lock ( ) {
210- if let Some ( info) = g. get_mut ( & sid[ ..sid. len ( ) . min ( 8 ) ] ) {
211- info. depth = depth;
212- info. inflight = inflight;
213- info. elevated = elevated;
214- }
215- }
216- }
170+ pub fn push_event ( _msg : String ) { }
171+ pub fn set_limits ( _max_elev : u64 , _max_batches : u64 ) { }
172+ pub fn set_elevated ( _n : u64 ) { }
173+ pub fn batch_acquire ( ) { }
174+ pub fn batch_release ( ) { }
175+ pub fn session_start ( _sid : & str ) { }
176+ pub fn session_end ( _sid : & str ) { }
177+ pub fn session_update ( _sid : & str , _depth : usize , _inflight : usize , _elevated : bool ) { }
217178
218179 pub fn to_json ( ) -> String {
219180 let s = state ( ) ;
@@ -356,7 +317,7 @@ struct PendingOp {
356317}
357318
358319pub struct TunnelMux {
359- tx : mpsc:: Sender < MuxMsg > ,
320+ tx : mpsc:: UnboundedSender < MuxMsg > ,
360321 /// Set to `true` after the first time the tunnel-node rejects
361322 /// `connect_data` as unsupported. Subsequent sessions skip the
362323 /// optimistic path entirely and go straight to plain connect + data.
@@ -463,7 +424,7 @@ impl TunnelMux {
463424 MAX_ELEVATED_PER_DEPLOYMENT * unique_n as u64 ,
464425 ( CONCURRENCY_PER_DEPLOYMENT * unique_n) as u64 ,
465426 ) ;
466- let ( tx, rx) = mpsc:: channel ( 512 ) ;
427+ let ( tx, rx) = mpsc:: unbounded_channel ( ) ;
467428 tokio:: spawn ( mux_loop ( rx, fronter, step, max) ) ;
468429 Arc :: new ( Self {
469430 tx,
@@ -483,8 +444,12 @@ impl TunnelMux {
483444 } )
484445 }
485446
447+ fn send_sync ( & self , msg : MuxMsg ) {
448+ let _ = self . tx . send ( msg) ;
449+ }
450+
486451 async fn send ( & self , msg : MuxMsg ) {
487- let _ = self . tx . send ( msg) . await ;
452+ let _ = self . tx . send ( msg) ;
488453 }
489454
490455 pub async fn udp_open (
@@ -745,7 +710,7 @@ impl TunnelMux {
745710 }
746711}
747712
748- async fn mux_loop ( mut rx : mpsc:: Receiver < MuxMsg > , fronter : Arc < DomainFronter > , coalesce_step_ms : u64 , coalesce_max_ms : u64 ) {
713+ async fn mux_loop ( mut rx : mpsc:: UnboundedReceiver < MuxMsg > , fronter : Arc < DomainFronter > , coalesce_step_ms : u64 , coalesce_max_ms : u64 ) {
749714 let coalesce_step = Duration :: from_millis ( coalesce_step_ms) ;
750715 let coalesce_max = Duration :: from_millis ( coalesce_max_ms) ;
751716 // One semaphore per deployment ID, each allowing 30 concurrent requests.
@@ -1100,6 +1065,10 @@ async fn fire_batch(
11001065 if let Some ( resp) = batch_resp. r . get ( idx) {
11011066 let _ = reply. send ( Ok ( ( resp. clone ( ) , script_id. clone ( ) ) ) ) ;
11021067 } else {
1068+ tracing:: error!(
1069+ "batch response mismatch: idx={} but r.len()={} (sent {} ops) from script {}" ,
1070+ idx, batch_resp. r. len( ) , n_ops, sid_short,
1071+ ) ;
11031072 let _ = reply. send ( Err ( format ! (
11041073 "missing response in batch from script {}" ,
11051074 sid_short
@@ -1524,7 +1493,7 @@ async fn upload_task(
15241493 }
15251494 Ok ( Ok ( more_n) ) => {
15261495 data. extend_from_slice ( & buf[ ..more_n] ) ;
1527- // Extend window if we hit 32KB threshold
1496+ // Extend window if we hit 8KB threshold
15281497 if !extended && data. len ( ) >= 8 * 1024 {
15291498 deadline = tokio:: time:: Instant :: now ( ) + Duration :: from_secs ( 1 ) ;
15301499 extended = true ;
0 commit comments