public class BitTorrent implements EDProtocol {
/**
* 配置文件中读取的文件大小
* @config
*/
private static final String PAR_SIZE="file_size";
/**
* The Transport used by the the protocol.
* @config
*/
private static final String PAR_TRANSPORT="transport";
/**
* 配置文件中读取一个节点虽多能拥有的邻居数
* @config
*/
private static final String PAR_SWARM="max_swarm_size";
/**
* tracker向普通节点返回的一个子集,用于交换bitfield成为邻居
* @config
*/
private static final String PAR_PEERSET_SIZE="peerset_size";
/**
* 当前网络最多能动态增加的节点数
* @config
*/
private static final String PAR_MAX_GROWTH="max_growth";
/**
* 单个request能向多少个节点同时发送
* @config
*/
private static final String PAR_DUP_REQ = "duplicated_requests";
/**
* KEEP_ALIVE message.
* @see SimpleEvent#type "Event types"
*/
private static final int KEEP_ALIVE = 1;
/**
* CHOKE message.
* @see SimpleEvent#type "Event types"
*/
private static final int CHOKE = 2;
/**
* UNCHOKE message.
* @see SimpleEvent#type "Event types"
*/
private static final int