Add user PING support (#346)
- Add `share::PingPong`, which can send `Ping`s, and poll for the `Pong` from the peer.
This commit is contained in:
@@ -14,6 +14,7 @@ pub struct Ping {
|
||||
// This was just 8 randomly generated bytes. We use something besides just
|
||||
// zeroes to distinguish this specific PING from any other.
|
||||
const SHUTDOWN_PAYLOAD: Payload = [0x0b, 0x7b, 0xa2, 0xf0, 0x8b, 0x9b, 0xfe, 0x54];
|
||||
const USER_PAYLOAD: Payload = [0x3b, 0x7c, 0xdb, 0x7a, 0x0b, 0x87, 0x16, 0xb4];
|
||||
|
||||
impl Ping {
|
||||
|
||||
@@ -23,6 +24,12 @@ impl Ping {
|
||||
#[cfg(not(feature = "unstable"))]
|
||||
pub(crate) const SHUTDOWN: Payload = SHUTDOWN_PAYLOAD;
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
pub const USER: Payload = USER_PAYLOAD;
|
||||
|
||||
#[cfg(not(feature = "unstable"))]
|
||||
pub(crate) const USER: Payload = USER_PAYLOAD;
|
||||
|
||||
pub fn new(payload: Payload) -> Ping {
|
||||
Ping {
|
||||
ack: false,
|
||||
|
||||
Reference in New Issue
Block a user