}
}
-/** @brief Retrieves the peer list from the tracker
+/** @brief Retrieves the peer list from the tracker
* @param peer current peer data
*/
int get_peers_data(peer_t peer)
xbt_free(peer);
}
-/** @brief Returns if a peer has finished downloading the file
+/** @brief Returns if a peer has finished downloading the file
* @param bitfield peer bitfield
*/
int has_finished(unsigned int bitfield)
char *key;
xbt_dict_cursor_t cursor;
connection_t connection;
- int interested;
xbt_dict_foreach(peer->peers, cursor, key, connection) {
- interested = 0;
if (connection->am_interested != 0) {
+ int interested = 0;
//Check if the peer still has a piece we want.
for (int i = 0; i < FILE_PIECES; i++) {
if (peer_has_not_piece(peer, i) && connection_has_piece(connection,i)) {