Skip to content

Commit dd36181

Browse files
committed
Sliding window pipeline + credit request bump + SmbClient accessors
Sliding window: each received response immediately triggers sending the next chunk, keeping the TCP pipe full at all times. Replaces the batch "send N, wait for all N" pattern that left gaps between windows. Credit request bumped from 32 to 256 per request. The server grants what it can afford — we just ask for more. Credits grow rapidly (511 → 15,842 after 20 operations in diagnostic test). Read pipeline: 64 KB chunks (CreditCharge=1, max concurrency). Write pipeline: MaxWriteSize chunks (minimize overhead). Window capped at 32 in-flight requests. Added SmbClient::credits() and estimated_rtt() accessors. Added diagnostic integration test for rapid pipelined writes. 521 unit tests + 15 integration tests, zero clippy warnings.
1 parent 031d52b commit dd36181

4 files changed

Lines changed: 386 additions & 204 deletions

File tree

src/client/connection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl Connection {
324324
) -> Result<(MessageId, Vec<u8>)> {
325325
let mut header = Header::new_request(command);
326326
header.message_id = MessageId(self.next_message_id);
327-
header.credits = 32; // Request more credits.
327+
header.credits = 256; // Request more credits.
328328
header.credit_charge = CreditCharge(1);
329329
header.session_id = self.session_id;
330330
if let Some(tid) = tree_id {
@@ -369,7 +369,7 @@ impl Connection {
369369
) -> Result<(MessageId, Vec<u8>)> {
370370
let mut header = Header::new_request(command);
371371
header.message_id = MessageId(self.next_message_id);
372-
header.credits = 32; // Request more credits.
372+
header.credits = 256; // Request more credits.
373373
header.credit_charge = CreditCharge(credit_charge);
374374
header.session_id = self.session_id;
375375
if let Some(tid) = tree_id {

src/client/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,16 @@ impl SmbClient {
181181
&self.config
182182
}
183183

184+
/// Current number of available credits.
185+
pub fn credits(&self) -> u16 {
186+
self.conn.credits()
187+
}
188+
189+
/// Estimated round-trip time from the negotiate exchange.
190+
pub fn estimated_rtt(&self) -> Option<Duration> {
191+
self.conn.estimated_rtt()
192+
}
193+
184194
/// Get a mutable reference to the underlying connection.
185195
///
186196
/// Needed when using [`Tree`] methods directly, since they require

0 commit comments

Comments
 (0)