Skip to content

Commit f9224b1

Browse files
committed
rename ExecCommand to Edge
1 parent 423280f commit f9224b1

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

src/exec/use_pty/backchannel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,31 +199,31 @@ impl AsFd for ParentBackchannel {
199199
/// Different messages exchanged between the monitor and the parent process using a [`ParentBackchannel`].
200200
#[derive(PartialEq, Eq)]
201201
pub(super) enum MonitorMessage {
202-
ExecCommand,
202+
Edge,
203203
Signal(c_int),
204204
}
205205

206206
impl MonitorMessage {
207207
const LEN: usize = PREFIX_LEN + MONITOR_DATA_LEN;
208-
const EXEC_CMD: Prefix = 0;
208+
const EDGE_CMD: Prefix = 0;
209209
const SIGNAL: Prefix = 1;
210210

211211
fn from_parts(prefix: Prefix, data: MonitorData) -> Self {
212212
match prefix {
213-
Self::EXEC_CMD => Self::ExecCommand,
213+
Self::EDGE_CMD => Self::Edge,
214214
Self::SIGNAL => Self::Signal(data),
215215
_ => unreachable!(),
216216
}
217217
}
218218

219219
fn to_parts(&self) -> (Prefix, MonitorData) {
220220
let prefix = match self {
221-
MonitorMessage::ExecCommand => Self::EXEC_CMD,
221+
MonitorMessage::Edge => Self::EDGE_CMD,
222222
MonitorMessage::Signal(_) => Self::SIGNAL,
223223
};
224224

225225
let data = match self {
226-
MonitorMessage::ExecCommand => 0,
226+
MonitorMessage::Edge => 0,
227227
MonitorMessage::Signal(data) => *data,
228228
};
229229

@@ -234,7 +234,7 @@ impl MonitorMessage {
234234
impl std::fmt::Debug for MonitorMessage {
235235
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
236236
match self {
237-
Self::ExecCommand => "ExecCommand".fmt(f),
237+
Self::Edge => "Edge".fmt(f),
238238
&Self::Signal(signal) => write!(f, "Signal({})", signal_fmt(signal)),
239239
}
240240
}

src/exec/use_pty/monitor.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ pub(super) fn exec_monitor(
7575
err
7676
})?;
7777
// Given that `UnixStream` delivers messages in order it shouldn't be possible to
78-
// receive an event different to `ExecCommand` at the beginning.
79-
debug_assert_eq!(event, MonitorMessage::ExecCommand);
78+
// receive an event different to `Edge` at the beginning.
79+
debug_assert_eq!(event, MonitorMessage::Edge);
8080

8181
// FIXME (ogsudo): Some extra config happens here if selinux is available.
8282

@@ -176,7 +176,7 @@ pub(super) fn exec_monitor(
176176
dev_warn!("cannot receive red light from parent: {err}");
177177
err
178178
})?;
179-
debug_assert_eq!(event, MonitorMessage::ExecCommand);
179+
debug_assert_eq!(event, MonitorMessage::Edge);
180180

181181
// FIXME (ogsudo): The tty is restored here if selinux is available.
182182

@@ -317,8 +317,8 @@ impl<'a> MonitorClosure<'a> {
317317
}
318318
Ok(event) => {
319319
match event {
320-
// We shouldn't receive this event more than once.
321-
MonitorMessage::ExecCommand => unreachable!(),
320+
// We shouldn't receive this event at this point in the protocol
321+
MonitorMessage::Edge => unreachable!(),
322322
// Forward signal to the command.
323323
MonitorMessage::Signal(signal) => {
324324
if let Some(command_pid) = self.command_pid {

src/exec/use_pty/parent.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,10 @@ pub(in crate::exec) fn exec_pty(
202202
drop(backchannels.monitor);
203203

204204
// Send green light to the monitor after closing the follower.
205-
retry_while_interrupted(|| backchannels.parent.send(&MonitorMessage::ExecCommand)).map_err(
206-
|err| {
207-
dev_error!("cannot send green light to monitor: {err}");
208-
err
209-
},
210-
)?;
205+
retry_while_interrupted(|| backchannels.parent.send(&MonitorMessage::Edge)).map_err(|err| {
206+
dev_error!("cannot send green light to monitor: {err}");
207+
err
208+
})?;
211209

212210
let mut closure = ParentClosure::new(
213211
monitor_pid,
@@ -349,7 +347,7 @@ impl ParentClosure {
349347
StopReason::Exit(ParentExit::Command(exit_reason)) => Ok(exit_reason),
350348
};
351349
// Send red light to the monitor after processing all events
352-
retry_while_interrupted(|| self.backchannel.send(&MonitorMessage::ExecCommand)).map_err(
350+
retry_while_interrupted(|| self.backchannel.send(&MonitorMessage::Edge)).map_err(
353351
|err| {
354352
dev_error!("cannot send red light to monitor: {err}");
355353
err

0 commit comments

Comments
 (0)