Skip to main content

Module connection

Module connection 

Source
Expand description

One connection to the server, on its own thread: it asks for the file and writes the body into the file the download gives it, telling the download each step.

A connection blocked waiting for the server can’t be interrupted, so the download never waits for one: it closes the connection’s Outlet, and the connection stops at its next write without touching the file again.

Structs§

Closed 🔒
What a closed outlet leaves: the file it was writing, if it had opened, and how many bytes went through it.
Dial 🔒
What a connection asks for: url, or just range of it, with the app’s headers.
Inner 🔒
Outlet 🔒
Where a connection writes: nowhere yet, the download’s file, or nowhere ever again.

Enums§

ConnectionError 🔒
Why a connection stopped early.
Flow 🔒
Whether a connection can keep writing after a write.
Slot 🔒

Constants§

CHUNK_SIZE 🔒

Functions§

copy 🔒
Copies body through outlet: Some(()) at the end of the body or once the outlet is full, None when the download stopped listening first.
spawn 🔒
Starts a connection asking agent for what dial says, which writes into outlet and tells events how it goes.

Type Aliases§

ConnectionId 🔒
Which of a download’s connections an event comes from, counted from 0, so events from one it has stopped can be told apart from the one it runs now.