Commit 1295e3eb authored by xuwencheng's avatar xuwencheng

serde

parent d6597d37
...@@ -146,6 +146,16 @@ impl Protocol { ...@@ -146,6 +146,16 @@ impl Protocol {
}) })
} }
pub fn ping() -> Result<Self> {
let fixed = FixedHeader::default(PacketType::PingReq);
Ok(Self {
trace_id: id::uuid(),
fixed,
variable: None,
payload: None,
})
}
pub fn pong() -> Result<Self> { pub fn pong() -> Result<Self> {
let fixed = FixedHeader::default(PacketType::PongResp); let fixed = FixedHeader::default(PacketType::PongResp);
Ok(Self { Ok(Self {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment