def checkResults
      results = []
      while true
        result = @pieceManager.nextResult
        break if ! result

        results.push result
          
        metaData = @pieceManagerRequests.delete(result.requestId)
        if ! metaData
          @logger.error "Can't find metadata for PieceManager request #{result.requestId}"
          next
        end 

        if metaData.type == :write
          if result.successful?
            @completePieces.set(metaData.data)
          else
            @requestedPieces.clear(metaData.data)
            @pieceRequestTime[metaData.data] = nil
            @logger.error "Writing metainfo piece failed: #{result.error}"
          end
        elsif metaData.type == :read
          if ! result.successful?
            @logger.error "Reading metainfo piece failed: #{result.error}"
          end
        end
      end
      results
    end
def checkResults
      results = []
      while true
        result = @pieceManager.nextResult
        break if ! result

        results.push result
          
        metaData = @pieceManagerRequests.delete(result.requestId)
        if ! metaData
          @logger.error "Can't find metadata for PieceManager request #{result.requestId}"
          next
        end 

        if metaData.type == :write
          if result.successful?
            @completePieces.set(metaData.data)
          else
            @requestedPieces.clear(metaData.data)
            @pieceRequestTime[metaData.data] = nil
            @logger.error "Writing metainfo piece failed: #{result.error}"
          end
        elsif metaData.type == :read
          if ! result.successful?
            @logger.error "Reading metainfo piece failed: #{result.error}"
          end
        end
      end
      results
    end
Check the results of savePiece and readPiece. This method returns a list
 of the PieceManager results.