pub struct PingRequest {
pub ping_id: u64,
}
Expand description
Sent by both client and server, both will respond.
Ping packets are used to know if the other side of the connection is still
live. TCP when established doesn’t have any sane timeouts (1 week isn’t sane)
so we are obliged to have our own way to check if the other side is still live.
Ping ids can be anything except 0, this is because of how toxcore sets the
variable storing the ping_id
that was sent to 0 when it receives a pong
response which means 0 is invalid.
The server should send ping packets every X seconds (toxcore TCP_server
sends
them every 30 seconds and times out the peer if it doesn’t get a response in 10).
The server should respond immediately to ping packets with pong packets.
Serialized form:
Length | Content |
---|---|
1 | 0x04 |
8 | ping_id in BigEndian |
Fields§
§ping_id: u64
The id of ping
Trait Implementations§
Source§impl Clone for PingRequest
impl Clone for PingRequest
Source§fn clone(&self) -> PingRequest
fn clone(&self) -> PingRequest
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PingRequest
impl Debug for PingRequest
Source§impl FromBytes for PingRequest
impl FromBytes for PingRequest
Source§fn from_bytes(i: &[u8]) -> IResult<&[u8], PingRequest, (&[u8], ErrorKind)>
fn from_bytes(i: &[u8]) -> IResult<&[u8], PingRequest, (&[u8], ErrorKind)>
Deserialize struct using
nom
from raw bytesSource§impl PartialEq for PingRequest
impl PartialEq for PingRequest
Source§impl ToBytes for PingRequest
impl ToBytes for PingRequest
impl StructuralPartialEq for PingRequest
Auto Trait Implementations§
impl Freeze for PingRequest
impl RefUnwindSafe for PingRequest
impl Send for PingRequest
impl Sync for PingRequest
impl Unpin for PingRequest
impl UnwindSafe for PingRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more