I thought about this yesterday, didn't feel like messing with it honestly that day, but the more I thought about it, the more I realized it would be hard to fix, I mean make work consistently, in the various edge-cases, and that I began to believe it wasen't an ltconfig issue even, but more as said an annoying confusing usability kinda issue, but not technically wrong I guessed. Now looking at the code, I see it actually has code to revert back to default when unticking an option, but still there's an obvious issue still I see. Anyway, I reproduced that it indeed revert back to default, but still before mentioned issue there. What I mean is that there's two issues, one is that at start of plugin(with deluge), then ltconfig saves the original libtorrent settings, and so when unticking an option then it reverts back to default, and where default means that saved part at plugin startup, so just from today/current-run. So, closing deluge, or deluged specifically when in thinclient mode, and then restarting and unticking an option, then it will still stick because ltconfig thinks is back to default again. Same is the other issue of if deleting a setting from ltconfig.conf, then ltconfig have no way of knowing this, and so will do nothing about that option, and it might be in session.state already, from previous ltconfig run. These issues I don't see anyway to overcome honestly, so we just have to, if feel needed, delete session.state manually upon changing config-files or if wanna make sure everything is right when not sure if such a situation could have occured otherwise, also from just GUI usage etc. It helps seeing it as ltconfig can change options for current running session, and if enabled in GUI or available in config, then means defined for chainging by ltconfig, and if not, then isn't, and nothing other is known about defaults, other than from current startup, and is out of scope imho to make it think about other plugins changing settings, deluge's preferences changed after startup, and old settings still in session-state from itself or other plugins maybe etc etc.
Btw, I see in code that the libtorrent default preset also just is a hardcoded list of settings, like high-performance-seed and min-memory-usage, which I don't like as some settings outdated or missing or changed, but not much I can do about that honestly, except manually keep updated and which i'm to lazy for honestly, and I only updated previously the high-performance-seed preset because thought was most important. Side-point, I also see in code that when selecting a preset, then it only saves to config the settings that are different from currently loaded libtorrent settings, so if re-using configs, then have to keep that in mind, e.g. before mentioned deleting of session.state etc. That is nice for not having config-settings that is irrelevant/redundant, but could make it little less precise. I can change that, but honestly I prefer to leave it, as all these are edge-cases which are nice normally, and just annoying in before said edge-cases. Ohh, forgot to say the pre-ltconfig "preset", is actually gotten from session and not from hardcoded list, though pretty obvious, but just adding for completeness.
Last, session state, as bengalih asked about, is as ambipro stated. When coding a client, then have to setup the libtorrent session and add all the settings you want away from default, and instead of adding a bunch of them every time, then can save and restore the session settings through that, plus it also adds the dht table and ipfilters and such, so a save/restore of current state, as ambipro stated. Also, as changed settings sometimes only saved to config at closing an app, then when a loop defined for saving current settings at x mins(in session.state), then also nice of-course. Honestly i've been to lazy to see how deluge handles that, well other than save and restore the session from libtorrent calls, at startup/closing and at x mins in loop, but I mean in regards to applying it's own settings, but I did check that they are matched i.e. if deleting a setting from core.conf, which is in session.state, then is reverted back to default again - well i'm guessing it just add all the options again regardless, from core.conf, and if any misses, then just uses the default, which is overriding the one in session.state, and this isn't really possible implement for ltconfig, but anyway, not an issue here, so in effect, you don't miss anything really(from deleting it), except in the case of ltconfig settings not in your config and so neither restored from said deleted session.state anymore, but as said pretty niche edge-case, and you shouldn't miss any deluge settings as far I know, sorry for stating before that this was a possibility, I don't see how unless mistaken, and eveything is just reloaded in from deluge and plugins again, so no worries, and as said I before deleted it from the unofficial installer upon every update, as got tired of reports of old libtorrent settings making updated libtorrent stalled and breaking deluge starting, and repeating the same thing over and over, so would say it's fine, but as always keep backups(in general).
If we can think of something, or if I have misunderstood anything, then of-course we can look at it some more, but just currently my humble opinion. Atleast this situation was made aware about, well for people finding this lol, but regardless, so thanks bengalih for reporting and thanks ambipro for your thoughts, appreciate you guys
