mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
parent
e082a21751
commit
983b7814aa
4 changed files with 12 additions and 1 deletions
|
@ -92,7 +92,8 @@ namespace BitTorrent
|
||||||
{
|
{
|
||||||
Default = 0,
|
Default = 0,
|
||||||
MMap = 1,
|
MMap = 1,
|
||||||
Posix = 2
|
Posix = 2,
|
||||||
|
SimplePreadPwrite = 3
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(DiskIOType)
|
Q_ENUM_NS(DiskIOType)
|
||||||
|
|
||||||
|
|
|
@ -1638,6 +1638,13 @@ void SessionImpl::initializeNativeSession()
|
||||||
#ifdef QBT_USES_LIBTORRENT2
|
#ifdef QBT_USES_LIBTORRENT2
|
||||||
// preserve the same behavior as in earlier libtorrent versions
|
// preserve the same behavior as in earlier libtorrent versions
|
||||||
pack.set_bool(lt::settings_pack::enable_set_file_valid_data, true);
|
pack.set_bool(lt::settings_pack::enable_set_file_valid_data, true);
|
||||||
|
|
||||||
|
// This is a special case. We use MMap disk IO but tweak it to always fallback to pread/pwrite.
|
||||||
|
if (diskIOType() == DiskIOType::SimplePreadPwrite)
|
||||||
|
{
|
||||||
|
pack.set_int(lt::settings_pack::mmap_file_size_cutoff, std::numeric_limits<int>::max());
|
||||||
|
pack.set_int(lt::settings_pack::disk_write_mode, lt::settings_pack::mmap_write_mode_t::always_pwrite);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lt::session_params sessionParams {std::move(pack), {}};
|
lt::session_params sessionParams {std::move(pack), {}};
|
||||||
|
@ -1648,6 +1655,7 @@ void SessionImpl::initializeNativeSession()
|
||||||
sessionParams.disk_io_constructor = customPosixDiskIOConstructor;
|
sessionParams.disk_io_constructor = customPosixDiskIOConstructor;
|
||||||
break;
|
break;
|
||||||
case DiskIOType::MMap:
|
case DiskIOType::MMap:
|
||||||
|
case DiskIOType::SimplePreadPwrite:
|
||||||
sessionParams.disk_io_constructor = customMMapDiskIOConstructor;
|
sessionParams.disk_io_constructor = customMMapDiskIOConstructor;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -585,6 +585,7 @@ void AdvancedSettings::loadAdvancedSettings()
|
||||||
m_comboBoxDiskIOType.addItem(tr("Default"), QVariant::fromValue(BitTorrent::DiskIOType::Default));
|
m_comboBoxDiskIOType.addItem(tr("Default"), QVariant::fromValue(BitTorrent::DiskIOType::Default));
|
||||||
m_comboBoxDiskIOType.addItem(tr("Memory mapped files"), QVariant::fromValue(BitTorrent::DiskIOType::MMap));
|
m_comboBoxDiskIOType.addItem(tr("Memory mapped files"), QVariant::fromValue(BitTorrent::DiskIOType::MMap));
|
||||||
m_comboBoxDiskIOType.addItem(tr("POSIX-compliant"), QVariant::fromValue(BitTorrent::DiskIOType::Posix));
|
m_comboBoxDiskIOType.addItem(tr("POSIX-compliant"), QVariant::fromValue(BitTorrent::DiskIOType::Posix));
|
||||||
|
m_comboBoxDiskIOType.addItem(tr("Simple pread/pwrite"), QVariant::fromValue(BitTorrent::DiskIOType::SimplePreadPwrite));
|
||||||
m_comboBoxDiskIOType.setCurrentIndex(m_comboBoxDiskIOType.findData(QVariant::fromValue(session->diskIOType())));
|
m_comboBoxDiskIOType.setCurrentIndex(m_comboBoxDiskIOType.findData(QVariant::fromValue(session->diskIOType())));
|
||||||
addRow(DISK_IO_TYPE, tr("Disk IO type (requires restart)") + u' ' + makeLink(u"https://www.libtorrent.org/single-page-ref.html#default-disk-io-constructor", u"(?)")
|
addRow(DISK_IO_TYPE, tr("Disk IO type (requires restart)") + u' ' + makeLink(u"https://www.libtorrent.org/single-page-ref.html#default-disk-io-constructor", u"(?)")
|
||||||
, &m_comboBoxDiskIOType);
|
, &m_comboBoxDiskIOType);
|
||||||
|
|
|
@ -1226,6 +1226,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
|
||||||
<option value="0">QBT_TR(Default)QBT_TR[CONTEXT=OptionsDialog]</option>
|
<option value="0">QBT_TR(Default)QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||||
<option value="1">QBT_TR(Memory mapped files)QBT_TR[CONTEXT=OptionsDialog]</option>
|
<option value="1">QBT_TR(Memory mapped files)QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||||
<option value="2">QBT_TR(POSIX-compliant)QBT_TR[CONTEXT=OptionsDialog]</option>
|
<option value="2">QBT_TR(POSIX-compliant)QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||||
|
<option value="3">QBT_TR(Simple pread/pwrite)QBT_TR[CONTEXT=OptionsDialog]</option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue