X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2b9e15c1a85e32f98027ba1f1ce99bed29490f49..c078a363724fe8ef749dfbda30f09b5f471643f7:/examples/msg/bittorrent/peer.c diff --git a/examples/msg/bittorrent/peer.c b/examples/msg/bittorrent/peer.c index 2a9db33a5c..632b19e0a0 100644 --- a/examples/msg/bittorrent/peer.c +++ b/examples/msg/bittorrent/peer.c @@ -48,6 +48,7 @@ int peer(int argc, char *argv[]) XBT_DEBUG("Got %d peers from the tracker", xbt_dict_length(peer.peers)); XBT_DEBUG("Here is my current status: %s", peer.bitfield); peer.begin_receive_time = MSG_get_clock(); + MSG_mailbox_set_async(peer.mailbox); if (has_finished(peer.bitfield)) { peer.pieces = FILE_PIECES; send_handshake_all(&peer); @@ -571,7 +572,7 @@ void update_choked_peers(peer_t peer) //remove a peer from the list xbt_dict_cursor_t cursor = NULL; xbt_dict_cursor_first(peer->active_peers, &cursor); - if (xbt_dict_length(peer->active_peers) > 0) { + if (!xbt_dict_is_empty(peer->active_peers)) { key = xbt_dict_cursor_get_key(cursor); connection_t peer_choked = xbt_dict_cursor_get_data(cursor); if (peer_choked) {