Skip to content

Commit

Permalink
method Request::is_a_stop()
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Mar 13, 2023
1 parent 4ec1b21 commit c4dbf90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl CommandServer {
offset = buffer.data().offset(i);

/*
TODO: maybe we should put on Innerrequest the version field we had on CommandRequest: a u32 to track versionning
TODO: maybe we should put on WorkerRequest the version field we had on CommandRequest: a u32 to track versionning
if requests.iter().any(|o| {
if o.version > PROTOCOL_VERSION {
error!("configuration protocol version mismatch: Sōzu handles up to version {}, the message uses version {}", PROTOCOL_VERSION, o.version);
Expand Down Expand Up @@ -1233,7 +1233,7 @@ impl CommandServer {
worker_count += 1;
}

let should_stop_main = request == Request::SoftStop || request == Request::HardStop;
let should_stop_main = request.is_a_stop();

let mut command_tx = self.command_tx.clone();
let thread_client_id = client_id.clone();
Expand Down
5 changes: 5 additions & 0 deletions command/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ impl Request {
}
proxy_destination
}

/// True if the request is a SoftStop or a HardStop
pub fn is_a_stop(&self) -> bool {
self == &Self::SoftStop || self == &Self::HardStop
}
}

/// This is sent only from Sōzu to Sōzu
Expand Down

0 comments on commit c4dbf90

Please sign in to comment.