X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/98c6a77b4cfe9cc585b3f2d00f9b4b0647c3ffa2..b0de305a8b86a97e8a01c30114b94941efa7886c:/examples/msg/app-bittorrent/peer.c diff --git a/examples/msg/app-bittorrent/peer.c b/examples/msg/app-bittorrent/peer.c index 5555e8633a..ee19ff211f 100644 --- a/examples/msg/app-bittorrent/peer.c +++ b/examples/msg/app-bittorrent/peer.c @@ -17,8 +17,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_peers, "Messages specific for the peers"); * User parameters for transferred file data. For the test, the default values are : * File size: 10 pieces * 5 blocks/piece * 16384 bytes/block = 819200 bytes */ -#define FILE_PIECES 10 -#define PIECES_BLOCKS 5 +#define FILE_PIECES 10U +#define PIECES_BLOCKS 5U #define BLOCK_SIZE 16384 static const unsigned long int FILE_SIZE = FILE_PIECES * PIECES_BLOCKS * BLOCK_SIZE; @@ -353,7 +353,8 @@ void handle_message(peer_t peer, msg_task_t task) xbt_assert((remote_peer != NULL), "A non-in-our-list peer has sent us a message. WTH ?"); xbt_assert(!remote_peer->choked_download); remote_peer->choked_download = 1; - remove_current_piece(peer, remote_peer, remote_peer->current_piece); + if (remote_peer->current_piece != -1) + remove_current_piece(peer, remote_peer, remote_peer->current_piece); break; case MESSAGE_HAVE: XBT_DEBUG("\t for piece %d", message->index);