- int pieces; //number of pieces the peer has.
- char *bitfield; //list of pieces the peer has.
- char *bitfield_blocks; //list of blocks the peer has.
- short *pieces_count; //number of peers that have each piece.
+ int pieces; //number of pieces the peer has.
+ char *bitfield; //list of pieces the peer has.
+ char *bitfield_blocks; //list of blocks the peer has.
+ short *pieces_count; //number of peers that have each piece.
- xbt_dynar_t current_pieces; //current pieces the peer is downloading
- int current_piece; //current pieces
- int pieces_requested; //number of pieces the peer has requested
+ xbt_dynar_t current_pieces; //current pieces the peer is downloading
- xbt_dict_t peers; //peers list
- xbt_dict_t active_peers; //active peers list
+ xbt_dict_t peers; //peers list
+ xbt_dict_t active_peers; //active peers list
+ int round; //current round for the chocking algortihm.
- msg_task_t task_received; //current task being received
- msg_comm_t comm_received; //current comm
+ char mailbox[MAILBOX_SIZE]; //peer mailbox.
+ char mailbox_tracker[MAILBOX_SIZE]; //pair mailbox while communicating with the tracker.
+ const char *hostname; //peer hostname
void update_interested_after_receive(peer_t peer);
void update_bitfield_blocks(peer_t peer, int index, int block_index,
void update_interested_after_receive(peer_t peer);
void update_bitfield_blocks(peer_t peer, int index, int block_index,
int piece_complete(peer_t peer, int index);
int get_first_block(peer_t peer, int piece);
int piece_complete(peer_t peer, int index);
int get_first_block(peer_t peer, int piece);
void send_have(peer_t peer, int piece);
void send_request(peer_t peer, const char *mailbox, int piece,
void send_have(peer_t peer, int piece);
void send_request(peer_t peer, const char *mailbox, int piece,
void send_piece(peer_t peer, const char *mailbox, int piece, int stalled,
void send_piece(peer_t peer, const char *mailbox, int piece, int stalled,