effusion v0.1.0 Effusion.BTP.Session View Source

The top-level data structure of a downloading file.

This module decides when to connect to peers, when to ask for pieces, when to write pieces to disk, etc.

Link to this section Summary

Functions

Add a block of data to this download

Add a peer to this session’s list of connected peers

Add a process that should be notified when this download completes or crashes

Announce an event to this download’s tracker, using the given Tracker HTTP Protocol (THP) client

Get the blocks that have not been assembled into pieces and verified

Check if this download has received all necessary bytes

Perform a function on all of this download’s listening processes

Perform actions necessary when a peer at a given address disconnects

Handle a Peer Wire Protocol (PWP) message send by the remote peer identified by peer_id

Get the set of listeners waiting for this torrent to finish

Create a new download

Get the next piece that this download should ask for

Remove a peer to this session’s list of connected peers

Start a download

Get the torrent that this download is downloading

Flush this download’s in-memory and verified pieces to disk

Link to this section Functions

Add a block of data to this download.

This may trigger messages to be sent to any connections associated with this download’s torrent.

Link to this function add_connected_peer(s, peer) View Source

Add a peer to this session’s list of connected peers.

This does not mean the session will connect to the peer, it is pretty much only used for testing.

Add a process that should be notified when this download completes or crashes.

Link to this function announce(s, client, event \\ :interval) View Source

Announce an event to this download’s tracker, using the given Tracker HTTP Protocol (THP) client.

Get the blocks that have not been assembled into pieces and verified.

Check if this download has received all necessary bytes.

Perform a function on all of this download’s listening processes.

Link to this function handle_disconnect(s, peer_id, address) View Source

Perform actions necessary when a peer at a given address disconnects.

Link to this function handle_message(session, peer_id, message) View Source

Handle a Peer Wire Protocol (PWP) message send by the remote peer identified by peer_id.

For more information about messages, see Effusion.PWP.Messages.

Get the set of listeners waiting for this torrent to finish.

Link to this function new(meta, local_server, file \\ nil) View Source

Create a new download.

This only creates a data structure. To actually start the download, call start/1.

Get the next piece that this download should ask for.

Link to this function remove_connected_peer(s, peer_id) View Source

Remove a peer to this session’s list of connected peers.

This does not mean the session will connect to the peer, it is pretty much only used for testing.

Link to this function start(session, thp_client) View Source

Start a download.

This means the session will make an announcement to the tracker and begin making connections.

Get the torrent that this download is downloading.

Flush this download’s in-memory and verified pieces to disk.