Expand description
The sender task: a single tokio::spawn-ed loop that owns MtpSender
and is the only entity that touches the TCP socket.
External callers interact via two channels:
-
RpcEnqueue: send a pre-serialised TL body + oneshot::Sender to the task. The task enqueues it intoMtpSender, and the oneshot is fulfilled when the server responds. This replaces the olddo_rpc_call+Mutex<ConnectionWriter>pendingHashMap pattern.
-
ReconnectRequest: send a new(TcpStream, EncryptedSession, FrameKind, Option<perm_key>)to the task after a reconnect completes. The task callsMtpSender::set_streamand resumes the loop.
The task forwards raw update bodies (everything MtpSender::step() returns
that is not an rpc_result) via FrameEvent to the client’s dispatch path.
Structs§
- Reconnect
Request - Reconnect request: replace the TCP stream inside the sender task.
- RpcEnqueue
- A single RPC request sent from any caller to the sender task.
- Sender
Handle - Sender-side handles given to the client after spawning the sender task.
Enums§
- Frame
Event - Events the sender task sends back to the client.
Functions§
- spawn_
sender_ task - Spawn the sender task. Returns a
SenderHandlefor the client and anmpsc::Receiver<FrameEvent>for receiving update bodies and errors.