Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion 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_write_timeout(timeout),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to invoke set_read_timeout here rather than set_write_timeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry about that; have fixed

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 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