-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libtorrent session options #3235
Conversation
I think this PR will have a better chance of getting merged by making these options available in "advanced options". Maybe later when I find time. |
518107c
to
3e025e8
Compare
Commits & first post updated. |
src/base/preferences.cpp
Outdated
@@ -1403,6 +1403,16 @@ void Preferences::setOsCache(bool enable) | |||
setValue("Preferences/Advanced/osCache", enable); | |||
} | |||
|
|||
bool Preferences::getGuidedReadCache() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preferences is deprecated now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole PR is outdated, I'm not even sure if @sledgehammer999 would approve this...
I plan to resurrect it after I'm done with other things, it's very low prio now. |
@Chocobo1 FYI, this is approved. You can resurrect and merge. And probably you don't need 3 separate commits. |
@Chocobo1 I think |
libtorrent made
Now I plan to add some other options, I'll put out a PR first, then we can bargain. |
3e025e8
to
77dea27
Compare
@sledgehammer999 @glassez
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And a final minor nitpick but 3 of your commit messages don't start with a capital letter like the others.
src/base/bittorrent/session.cpp
Outdated
@@ -270,6 +270,7 @@ Session::Session(QObject *parent) | |||
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY("MaxUploadsPerTorrent"), -1, lowerLimited(0, -1)) | |||
, m_isUTPEnabled(BITTORRENT_SESSION_KEY("uTPEnabled"), true) | |||
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY("uTPRateLimited"), true) | |||
, m_utpMixedMode(BITTORRENT_SESSION_KEY("utpMixedMode"), m_isUTPEnabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most existing installations are working today with prefer_tcp
. So I would say the default here should be false
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the name should be uTPMixedMode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the name should be uTPMixedMode
OK
So I would say the default here should be false.
Do you think we should also turn uTP off by default? otherwise, with uTP on + prefer_tcp, uTP would be useless in theory.
src/base/bittorrent/session.cpp
Outdated
|
||
void Session::setChokingAlgorithm(bool mode) | ||
{ | ||
if (mode == m_chokingAlgorithm)return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space before return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed here, will push update later
src/gui/advancedsettings.cpp
Outdated
@@ -187,6 +189,13 @@ void AdvancedSettings::saveAdvancedSettings() | |||
// Tracker | |||
session->setTrackerEnabled(cb_tracker_status.isChecked()); | |||
pref->setTrackerPort(spin_tracker_port.value()); | |||
|
|||
// Choking algorithm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need the blank lines before the comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will remove it.
src/base/bittorrent/session.cpp
Outdated
|
||
settingsPack.set_int(libt::settings_pack::choking_algorithm, | ||
chokingAlgorithm() ? libt::choking_algorithm_t::rate_based_choker : libt::choking_algorithm_t::fixed_slots_choker); | ||
settingsPack.set_int(libt::settings_pack::seed_choking_algorithm, seedChokingAlgorithm()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seed_choking_algorithm
is being set in the session constructor so you need to remove it from there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks!
src/gui/advancedsettings.cpp
Outdated
// Send buffer watermark | ||
spinSendBufferWatermark.setMinimum(1); | ||
spinSendBufferWatermark.setMaximum(INT_MAX); | ||
spinSendBufferWatermark.setSuffix(tr(" KB")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KiB
.
Also shouldn't it be non-translatable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also shouldn't it be non-translatable?
fixed, will also fix other locations.
1b82f06
to
012b22f
Compare
@sledgehammer999 |
src/gui/advancedsettings.cpp
Outdated
@@ -197,7 +223,7 @@ void AdvancedSettings::updateCacheSpinSuffix(int value) | |||
if (value <= 0) | |||
spin_cache.setSuffix(tr(" (auto)")); | |||
else | |||
spin_cache.setSuffix(tr(" MiB")); | |||
spin_cache.setSuffix(" MiB"); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this string isn't translatable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glassez: This was requested by @sledgehammer999
@sledgehammer999, why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a question.
Is it reasonable to have translatable units?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least some of the Cyrillic languages use transliterated abbreviations (e.g. "MіБ" for "MiB" in Ukrainian).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks, will fix it.
src/base/bittorrent/session.cpp
Outdated
void Session::setGuidedReadCache(bool enabled) | ||
{ | ||
if (enabled == m_guidedReadCache) return; | ||
m_guidedReadCache = enabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add blank line before this one like in another setters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
src/base/bittorrent/session.h
Outdated
@@ -314,6 +314,10 @@ namespace BitTorrent | |||
void setForceProxyEnabled(bool enabled); | |||
bool isProxyPeerConnectionsEnabled() const; | |||
void setProxyPeerConnectionsEnabled(bool enabled); | |||
bool chokingAlgorithm() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you provide originally enumerable setting as bool?
The same question is about mixed mode algorithm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both changed to int type.
src/base/bittorrent/session.h
Outdated
@@ -330,6 +334,16 @@ namespace BitTorrent | |||
void setDiskCacheTTL(uint ttl); | |||
bool useOSCache() const; | |||
void setUseOSCache(bool use); | |||
bool guidedReadCache() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use naming convention for bool properties: isGuidedReadCacheUsed or isGuidedReadCacheEnabled.
The same comment is for other bool properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming Boolean Getters, Setters, and Properties
Finding good names for the getter and setter of a bool property is always a special pain. Should the getter be called checked() or isChecked()? scrollBarsEnabled() or areScrollBarEnabled()?In Qt 4, we used the following guidelines for naming the getter function:
Adjectives are prefixed with is-. Examples:
isChecked()
isDown()
isEmpty()
isMovingEnabled()
However, adjectives applying to a plural noun have no prefix:
scrollBarsEnabled(), not areScrollBarsEnabled()
Verbs have no prefix and don't use the third person (-s):
acceptDrops(), not acceptsDrops()
allColumnsShowFocus()
Nouns generally have no prefix:
autoCompletion(), not isAutoCompletion()
boundaryChecking()
Sometimes, having no prefix is misleading, in which case we prefix with is-:
isOpenGLAvailable(), not openGL()
isDialog(), not dialog()
(From a function called dialog(), we would normally expect that it returns a QDialog.)
The name of the setter is derived from that of the getter by removing any is prefix and putting a set at the front of the name; for example, setDown() and setScrollBarsEnabled(). The name of the property is the same as the getter, but without the is prefix.
So useOSCache
kind of makes sense. Even guidedReadCache
can be used as bool property name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently I jumped the gun here... the point is that if bool property has a name without is-/has- prefix it's not so clear it is correct or not. We need to check all new bool properties.
1daf5a3
to
70df60b
Compare
PR updated. |
5ba34f9
to
ed7bdb2
Compare
885f338
to
e2eff8b
Compare
src/base/bittorrent/session.cpp
Outdated
@@ -299,6 +299,8 @@ Session::Session(QObject *parent) | |||
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0) | |||
, m_isForceProxyEnabled(BITTORRENT_SESSION_KEY("ForceProxy"), true) | |||
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false) | |||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), 0) | |||
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY("SeedChokingAlgorithm"), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value here should be 1
. It was a request in the past to use fastest_upload by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix
However, it feels weird because peer which has better download speed will always have higher priority to be served.
src/base/bittorrent/session.cpp
Outdated
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), 0) | ||
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY("SeedChokingAlgorithm"), 0) | ||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), 0, clampValue(0, 2)) | ||
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY("SeedChokingAlgorithm"), 0, clampValue(0, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value here should be 1
. It was a request in the past to use fastest_upload by default.
src/base/bittorrent/session.cpp
Outdated
@@ -296,6 +317,8 @@ Session::Session(QObject *parent) | |||
, m_encryption(BITTORRENT_SESSION_KEY("Encryption"), 0) | |||
, m_isForceProxyEnabled(BITTORRENT_SESSION_KEY("ForceProxy"), true) | |||
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY("ProxyPeerConnections"), false) | |||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY("ChokingAlgorithm"), 0, clampValue(0, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChockingAlgorithm should be limited by 0 and 1, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see enum choking_algorithm_t
in libtorrent doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in earlier commit you chose to not expose bittyrant_choker
.
Was there a reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't mix interface of components of an application with interface of underlying library. If you allow users only two choices then Session::chockingAlgorithm property has only two possible values independently of the way it really implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was there a reason?
libtorrent states its incomplete & untested.
Also read Q: Won’t BitTyrant hurt overall BitTorrent performance if everyone uses it?
in http://bittyrant.cs.washington.edu/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
libtorrent states its incomplete & untested.
Also read Q: Won’t BitTyrant hurt overall BitTorrent performance if everyone uses it?
in http://bittyrant.cs.washington.edu/
+1.
Don't forget to rebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't mix interface of components of an application with interface of underlying library
That won't be a problem after enums are deployed.
cleanup header include order
send_buffer_watermark_factor knobs
e2eff8b
to
c1a3389
Compare
Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last small comments. The rest LGTM.
src/base/bittorrent/session.cpp
Outdated
@@ -282,6 +301,9 @@ Session::Session(QObject *parent) | |||
, m_maxUploadsPerTorrent(BITTORRENT_SESSION_KEY("MaxUploadsPerTorrent"), -1, lowerLimited(0, -1)) | |||
, m_isUTPEnabled(BITTORRENT_SESSION_KEY("uTPEnabled"), true) | |||
, m_isUTPRateLimited(BITTORRENT_SESSION_KEY("uTPRateLimited"), true) | |||
, m_utpMixedMode(BITTORRENT_SESSION_KEY("uTPMixedMode"), static_cast<BitTorrent::MixedModeAlgorithm>(m_isUTPEnabled.value()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have dependent default value here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, using ternary operator (instead of cast) would be more obvious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have dependent default value here?
Ah, damn it, I didn't realize until now... it doesn't need to depend on others.
Changed.
c1a3389
to
2da2054
Compare
@evsh @sledgehammer999 |
No. |
thanks to everyone |
Was announce_to_all_tiers dropped because qBitTorrent lacks the GUI support for it? Send upload piece suggestions cripples upload speed for some reason. I'm guessing it's an super/initial seeding type of feature to be used with low upload max? prefer_tcp set to false also causes local peers to slow to almost nothing when internet uTP peers are connected even when LAN speeds are set to unlimited. |
>>First post outdated, see #3235 (comment) <<
I found some interesting options when reading libtorrent's document:
guided_read_cache: [default off]
Also see: tuning#disk-cache
This looks promising.
prefer_tcp: [default off]
Also see: tuning#utp-tcp-mixed-mode
Since there are issues with
peer_proportional
in the past, then just useprefer_tcp
in all cases.I can't see why this should be depending on
rate_limit_utp
.use_parole_mode: [default off]
Maybe give a hashcheck-failed peer another chance before banning.