Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
boring meeting commit: cognitive complexity reduction
[simgrid.git] / examples / s4u / app-bittorrent / s4u-peer.hpp
index 9a23ec5..e828e1d 100644 (file)
@@ -60,6 +60,10 @@ public:
   void updateChokedPeers();
 
   bool hasNotPiece(unsigned int piece) const { return not(bitfield_ & 1U << piece); }
+  bool remotePeerHasMissingPiece(const Connection* remote_peer, unsigned int piece)
+  {
+    return hasNotPiece(piece) && remote_peer->hasPiece(piece);
+  }
   bool hasCompletedPiece(unsigned int piece);
   unsigned int countPieces(unsigned int bitfield);
   /** Check that a piece is not currently being download by the peer. */