mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added experimental settings to prefer ipv6 when it is available
This commit is contained in:
parent
e33ca9d316
commit
0f283c484d
3 changed files with 14 additions and 1 deletions
|
@ -5,6 +5,7 @@ the official desktop application for the Telegram messaging service.
|
||||||
For license and copyright information please follow this link:
|
For license and copyright information please follow this link:
|
||||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
|
#include "base/options.h"
|
||||||
#include "mtproto/session_private.h"
|
#include "mtproto/session_private.h"
|
||||||
|
|
||||||
#include "mtproto/details/mtproto_bound_key_creator.h"
|
#include "mtproto/details/mtproto_bound_key_creator.h"
|
||||||
|
@ -138,8 +139,16 @@ void WrapInvokeAfter(
|
||||||
return different;
|
return different;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::options::toggle OptionPreferIPv6({
|
||||||
|
.id = kOptionPreferIPv6,
|
||||||
|
.name = "Prefer IPv6",
|
||||||
|
.description = "Prefer IPv6 if it is available",
|
||||||
|
});
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
const char kOptionPreferIPv6[] = "prefer-ipv6";
|
||||||
|
|
||||||
SessionPrivate::SessionPrivate(
|
SessionPrivate::SessionPrivate(
|
||||||
not_null<Instance*> instance,
|
not_null<Instance*> instance,
|
||||||
not_null<QThread*> thread,
|
not_null<QThread*> thread,
|
||||||
|
@ -187,7 +196,7 @@ void SessionPrivate::appendTestConnection(
|
||||||
const bytes::vector &protocolSecret) {
|
const bytes::vector &protocolSecret) {
|
||||||
QWriteLocker lock(&_stateMutex);
|
QWriteLocker lock(&_stateMutex);
|
||||||
|
|
||||||
const auto priority = (qthelp::is_ipv6(ip) ? 0 : 1)
|
const auto priority = (qthelp::is_ipv6(ip) ? (OptionPreferIPv6.value() ? 2 : 0) : 1)
|
||||||
+ (protocol == DcOptions::Variants::Tcp ? 1 : 0)
|
+ (protocol == DcOptions::Variants::Tcp ? 1 : 0)
|
||||||
+ (protocolSecret.empty() ? 0 : 1);
|
+ (protocolSecret.empty() ? 0 : 1);
|
||||||
_testConnections.push_back({
|
_testConnections.push_back({
|
||||||
|
|
|
@ -240,5 +240,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const char kOptionPreferIPv6[];
|
||||||
|
|
||||||
} // namespace details
|
} // namespace details
|
||||||
} // namespace MTP
|
} // namespace MTP
|
||||||
|
|
|
@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "media/player/media_player_instance.h"
|
#include "media/player/media_player_instance.h"
|
||||||
|
#include "mtproto/session_private.h"
|
||||||
#include "webview/webview_embed.h"
|
#include "webview/webview_embed.h"
|
||||||
#include "window/main_window.h"
|
#include "window/main_window.h"
|
||||||
#include "window/window_peer_menu.h"
|
#include "window/window_peer_menu.h"
|
||||||
|
@ -156,6 +157,7 @@ void SetupExperimental(
|
||||||
addToggle(Core::kOptionSkipUrlSchemeRegister);
|
addToggle(Core::kOptionSkipUrlSchemeRegister);
|
||||||
addToggle(Data::kOptionExternalVideoPlayer);
|
addToggle(Data::kOptionExternalVideoPlayer);
|
||||||
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
addToggle(Window::kOptionNewWindowsSizeAsFirst);
|
||||||
|
addToggle(MTP::details::kOptionPreferIPv6);
|
||||||
addToggle(Window::kOptionDisableTouchbar);
|
addToggle(Window::kOptionDisableTouchbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue