- 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_dict_t peers; //peers list
- xbt_dict_t active_peers; //active peers list
- int round; //current round for the chocking algortihm.
+ xbt_dict_t peers; //peers list
+ xbt_dict_t active_peers; //active peers list
+ int round; //current round for the chocking algortihm.
- char mailbox[MAILBOX_SIZE]; //peer mailbox.
- char mailbox_tracker[MAILBOX_SIZE]; //pair mailbox while communicating with the tracker.
- const char *hostname; //peer hostname
+ 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,