public void signalBlockComplete(int blockNumber) throws IOException { signalBlockCompleteCounter++; if (signalBlockCompleteCounter > SEND_BLOCKMASK_UPDATE_INTERVAL_IN_BLOCKS) { signalBlockCompleteCounter = 0; BlockFile bf = storage.getBlockFile(fd.getRootHash()); if (bf == null) { return; } List<Friend> list = manager.getFriendsInterestedIn(root); if (list != null) { for (Friend f : list) { FriendConnection fc = f.getFriendConnection(); if (fc != null) { if (T.t) { T.info( "Friend " + f + " is interested in file " + root + ". Sending updated block mask to him."); } fc.send(new BlockMaskResult(root, bf.getBlockMask())); } } } } }