pub struct DataConnection { /* private fields */ }Expand description
One client data connection of a TCP allocation: a second TCP (or TLS) connection to the TURN server that, once bound, carries one peer’s byte stream as it is (RFC 6062 §4.3 to §4.5).
Made by Relay::data_connection with the
CONNECTION-ID of a Connect success response (Event::ConnectResponse) or
of a ConnectionAttempt indication (Event::ConnectionAttempt). Sans-I/O:
the application opens the connection, to Self::server_addr and from a local port of
its own, and then
- sends what
poll_writegives, the ConnectionBind request first; - hands every chunk it reads to
handle_read(the stream as it comes: no framing is expected of the application); - calls
handle_timeoutwhenpoll_timeoutsays; - after
DataConnectionEvent::Bound, writes to the peer withhandle_writeorSelf::send, and takes the peer’s bytes frompoll_read.
Closing the TCP connection ends the peer’s connection too (RFC 6062 §4.6). The allocation
must be kept refreshed for as long as the data connection is wanted, which the
Client that made it does on its control connection.
Implementations§
Source§impl DataConnection
impl DataConnection
Sourcepub fn server_addr(&self) -> SocketAddr
pub fn server_addr(&self) -> SocketAddr
The server’s transport address: where the application opens this connection to, the same one the control connection goes to (RFC 6062 §4.3).
Sourcepub fn local_addr(&self) -> SocketAddr
pub fn local_addr(&self) -> SocketAddr
The local address the application said this connection is made from.
Sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
The CONNECTION-ID this connection binds.
Trait Implementations§
Source§impl Protocol<TransportMessage<BytesMut>, TransportMessage<BytesMut>, ()> for DataConnection
impl Protocol<TransportMessage<BytesMut>, TransportMessage<BytesMut>, ()> for DataConnection
Source§type Wout = TransportMessage<BytesMut>
type Wout = TransportMessage<BytesMut>
Bytes for the TCP connection to the server.
Source§fn handle_read(&mut self, msg: TaggedBytesMut) -> Result<()>
fn handle_read(&mut self, msg: TaggedBytesMut) -> Result<()>
Takes the next chunk read from the TCP connection, whatever its boundaries.
Source§fn handle_write(&mut self, msg: TaggedBytesMut) -> Result<()>
fn handle_write(&mut self, msg: TaggedBytesMut) -> Result<()>
Queues msg.message for the peer, as it is. msg.transport is not looked at.