Skip to content

Commit

Permalink
move and update decision comment
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Oct 25, 2023
1 parent 946afd1 commit c165557
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,18 @@ impl SchedulerController {

pub fn run(mut self) -> Result<(), SchedulerError> {
loop {
// BufferedPacketsDecision is shared with legacy BankingStage, which will forward
// packets. Initially, not renaming these decision variants but the actions taken
// are different, since new BankingStage will not forward packets.
// For `Forward` and `ForwardAndHold`, we want to receive packets but will not
// forward them to the next leader. In this case, `ForwardAndHold` is
// indistiguishable from `Hold`.
//
// `Forward` will drop packets from the buffer instead of forwarding.
// During receiving, since packets would be dropped from buffer anyway, we can
// bypass sanitization and buffering and immediately drop the packets.
let decision = self.decision_maker.make_consume_or_forward_decision();

self.process_transactions(&decision)?;
self.scheduler.receive_completed(&mut self.container)?;
if !self.receive_packets(&decision) {
Expand Down Expand Up @@ -98,14 +109,6 @@ impl SchedulerController {
fn receive_packets(&mut self, decision: &BufferedPacketsDecision) -> bool {
let remaining_queue_capacity = self.container.remaining_queue_capacity();

// BufferedPacketsDecision is shared with legacy BankingStage, which will forward
// packets. Initially, not renaming these decision variants but the actions taken
// are different, since new BankingStage will not forward packets.
// For `Forward` and `ForwardAndHold`, we want to receive packets but will not
// forward them to the next leader. Without holding, this means `Forward` would
// immediately drop them from the buffer anyway; instead we can bypass the buffer
// entirely and drop the packets immediately.
// In this case, `ForwardAndHold` is indistiguishable from `Hold`.
const MAX_PACKET_RECEIVE_TIME: Duration = Duration::from_millis(100);
let (recv_timeout, should_buffer) = match decision {
BufferedPacketsDecision::Consume(_) => (
Expand Down

0 comments on commit c165557

Please sign in to comment.