(ctl_path: &Path, ack_path: &Path)
| 118 | } |
| 119 | |
| 120 | pub fn open(ctl_path: &Path, ack_path: &Path) -> anyhow::Result<Self> { |
| 121 | create_fifo(ctl_path)?; |
| 122 | create_fifo(ack_path)?; |
| 123 | |
| 124 | let ack_fifo = open_fifo_sender(ack_path)?; |
| 125 | let ctl_fifo = open_fifo_receiver(ctl_path)?; |
| 126 | |
| 127 | let codec = LengthDelimitedCodec::builder() |
| 128 | .length_field_length(4) |
| 129 | .little_endian() |
| 130 | .new_codec(); |
| 131 | let ctl_reader = FramedRead::new(ctl_fifo, codec); |
| 132 | |
| 133 | Ok(Self { |
| 134 | ctl_path: ctl_path.to_path_buf(), |
| 135 | ack_path: ack_path.to_path_buf(), |
| 136 | ack_fifo, |
| 137 | ctl_reader, |
| 138 | }) |
| 139 | } |
| 140 | |
| 141 | pub async fn recv_cmd(&mut self) -> anyhow::Result<FifoCommand> { |
| 142 | let bytes = self |
no test coverage detected