dhaar-torrent 0.4.0

A BitTorrent client library: peer wire protocol, piece management and a resumable on-disk store
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::wire_protocol::WireItem;
use tokio::sync::mpsc::{Receiver, Sender, channel};

pub const CHANNEL_SIZE: usize = 256;

pub type IncomingChannelSender = Sender<WireItem>;
pub type IncomingChannelReceiver = Receiver<WireItem>;

pub fn new_incoming_channel() -> (Sender<WireItem>, Receiver<WireItem>) {
    channel(CHANNEL_SIZE)
}

pub type OutgoingChannelSender = Sender<WireItem>;
pub type OutgoingChannelReceiver = Receiver<WireItem>;

pub fn new_outgoing_channel() -> (Sender<WireItem>, Receiver<WireItem>) {
    channel(CHANNEL_SIZE)
}