mirror of
https://github.com/telemt/telemt.git
synced 2026-05-23 04:01:44 +03:00
Drafting ME Healthcheck
Co-Authored-By: brekotis <93345790+brekotis@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use crate::protocol::constants::*;
|
||||
pub(crate) enum WriterCommand {
|
||||
Data(Vec<u8>),
|
||||
DataAndFlush(Vec<u8>),
|
||||
Keepalive,
|
||||
Close,
|
||||
}
|
||||
|
||||
@@ -188,4 +189,12 @@ impl RpcWriter {
|
||||
self.send(payload).await?;
|
||||
self.writer.flush().await.map_err(ProxyError::Io)
|
||||
}
|
||||
|
||||
pub(crate) async fn send_keepalive(&mut self, payload: [u8; 4]) -> Result<()> {
|
||||
// Keepalive is a frame with fl == 4 and 4 bytes payload.
|
||||
let mut frame = Vec::with_capacity(8);
|
||||
frame.extend_from_slice(&4u32.to_le_bytes());
|
||||
frame.extend_from_slice(&payload);
|
||||
self.send(&frame).await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user