Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions pingora-core/src/protocols/http/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,19 @@ impl Session {
}
}

/// Sets the downstream read timeout. This will trigger if we're unable
/// to read from the stream after `timeout`.
///
/// This is a noop for h2.
pub fn set_read_timeout(&mut self, timeout: Duration) {
match self {
Self::H1(s) => s.set_read_timeout(timeout),
Self::H2(_) => {}
}
}

/// Sets the downstream write timeout. This will trigger if we're unable
/// to write to the stream after `duration`. If a `min_send_rate` is
/// to write to the stream after `timeout`. If a `min_send_rate` is
/// configured then the `min_send_rate` calculated timeout has higher priority.
///
/// This is a noop for h2.
Expand All @@ -207,7 +218,7 @@ impl Session {
/// rate must be greater than zero.
///
/// Calculated write timeout is guaranteed to be at least 1s if `min_send_rate`
/// is greater than zero, a send rate of zero is a noop.
/// is greater than zero, a send rate of zero is a noop.x
///
/// This is a noop for h2.
pub fn set_min_send_rate(&mut self, rate: usize) {
Expand Down
8 changes: 7 additions & 1 deletion pingora-core/src/protocols/http/v1/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,14 @@ impl HttpSession {
}
}

/// Sets the downstream read timeout. This will trigger if we're unable
/// to read from the stream after `timeout`.
pub fn set_read_timeout(&mut self, timeout: Duration) {
self.read_timeout = Some(timeout);
}

/// Sets the downstream write timeout. This will trigger if we're unable
/// to write to the stream after `duration`. If a `min_send_rate` is
/// to write to the stream after `timeout`. If a `min_send_rate` is
/// configured then the `min_send_rate` calculated timeout has higher priority.
pub fn set_write_timeout(&mut self, timeout: Duration) {
self.write_timeout = Some(timeout);
Expand Down
Loading