Merge pull request #6551 from tearfur/utp-backport
This commit is contained in:
commit
389adc6a2f
|
@ -140,6 +140,13 @@ string(APPEND TR_PEER_ID_PREFIX "-")
|
||||||
|
|
||||||
set(TR_VCS_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
|
set(TR_VCS_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
|
||||||
|
|
||||||
|
## Compiler standard version
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 11)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
if(EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
endif()
|
endif()
|
||||||
|
@ -594,13 +601,6 @@ endif()
|
||||||
|
|
||||||
unset(CMAKE_FOLDER)
|
unset(CMAKE_FOLDER)
|
||||||
|
|
||||||
## Compiler standard version
|
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
|
|
||||||
### Compiler Warnings
|
### Compiler Warnings
|
||||||
|
|
||||||
set(C_WARNING_FLAGS)
|
set(C_WARNING_FLAGS)
|
||||||
|
|
|
@ -3715,7 +3715,6 @@
|
||||||
0053D3D40C86774200545606 /* Debug */ = {
|
0053D3D40C86774200545606 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -3757,7 +3756,6 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
||||||
|
@ -3787,7 +3785,6 @@
|
||||||
0053D3D60C86774200545606 /* Debug */ = {
|
0053D3D60C86774200545606 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -3808,7 +3805,6 @@
|
||||||
0053D3D70C86774200545606 /* Debug */ = {
|
0053D3D70C86774200545606 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -3833,7 +3829,6 @@
|
||||||
0053D3D80C86774200545606 /* Debug */ = {
|
0053D3D80C86774200545606 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -3856,6 +3851,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
@ -3882,6 +3878,7 @@
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c11;
|
||||||
GCC_DYNAMIC_NO_PIC = YES;
|
GCC_DYNAMIC_NO_PIC = YES;
|
||||||
GCC_ENABLE_PASCAL_STRINGS = NO;
|
GCC_ENABLE_PASCAL_STRINGS = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
|
@ -3958,7 +3955,6 @@
|
||||||
4D18389C09DEC01E0047D688 /* Release */ = {
|
4D18389C09DEC01E0047D688 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -3999,7 +3995,6 @@
|
||||||
4DDBB71E09E16BF100284745 /* Release */ = {
|
4DDBB71E09E16BF100284745 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4021,7 +4016,6 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
||||||
|
@ -4053,6 +4047,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
@ -4078,6 +4073,7 @@
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
DEPLOYMENT_POSTPROCESSING = YES;
|
DEPLOYMENT_POSTPROCESSING = YES;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c11;
|
||||||
GCC_DYNAMIC_NO_PIC = YES;
|
GCC_DYNAMIC_NO_PIC = YES;
|
||||||
GCC_ENABLE_PASCAL_STRINGS = NO;
|
GCC_ENABLE_PASCAL_STRINGS = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
|
@ -4152,6 +4148,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
@ -4179,6 +4176,7 @@
|
||||||
DEPLOYMENT_POSTPROCESSING = YES;
|
DEPLOYMENT_POSTPROCESSING = YES;
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
ENABLE_TESTABILITY = YES;
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = c11;
|
||||||
GCC_DYNAMIC_NO_PIC = YES;
|
GCC_DYNAMIC_NO_PIC = YES;
|
||||||
GCC_ENABLE_PASCAL_STRINGS = NO;
|
GCC_ENABLE_PASCAL_STRINGS = NO;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
|
@ -4222,7 +4220,6 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
CODE_SIGN_ENTITLEMENTS = macosx/Transmission.entitlements;
|
||||||
|
@ -4252,7 +4249,6 @@
|
||||||
A250CFED0CDA19680068B4B6 /* Release - Debug */ = {
|
A250CFED0CDA19680068B4B6 /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4273,7 +4269,6 @@
|
||||||
A250CFEE0CDA19680068B4B6 /* Release - Debug */ = {
|
A250CFEE0CDA19680068B4B6 /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
HEADER_SEARCH_PATHS = (
|
HEADER_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
@ -4314,7 +4309,6 @@
|
||||||
A250CFEF0CDA19680068B4B6 /* Release - Debug */ = {
|
A250CFEF0CDA19680068B4B6 /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4339,7 +4333,6 @@
|
||||||
A250CFF00CDA19680068B4B6 /* Release - Debug */ = {
|
A250CFF00CDA19680068B4B6 /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4410,7 +4403,6 @@
|
||||||
A2F35BD115C5A0A100EBF632 /* Debug */ = {
|
A2F35BD115C5A0A100EBF632 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
||||||
|
@ -4439,7 +4431,6 @@
|
||||||
A2F35BD215C5A0A100EBF632 /* Release - Debug */ = {
|
A2F35BD215C5A0A100EBF632 /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
||||||
|
@ -4468,7 +4459,6 @@
|
||||||
A2F35BD315C5A0A100EBF632 /* Release */ = {
|
A2F35BD315C5A0A100EBF632 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = YES;
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
GCC_PREFIX_HEADER = "macosx/QuickLookPlugin/QuickLookPlugin-Prefix.pch";
|
||||||
|
@ -4541,7 +4531,6 @@
|
||||||
BEFC1C0A0C07753800B0BB3C /* Release */ = {
|
BEFC1C0A0C07753800B0BB3C /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4566,7 +4555,6 @@
|
||||||
BEFC1CF80C07822400B0BB3C /* Release */ = {
|
BEFC1CF80C07822400B0BB3C /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4758,7 +4746,6 @@
|
||||||
C8B27B7C28153F2B00A22B5D /* Debug */ = {
|
C8B27B7C28153F2B00A22B5D /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4779,7 +4766,6 @@
|
||||||
C8B27B7D28153F2B00A22B5D /* Release - Debug */ = {
|
C8B27B7D28153F2B00A22B5D /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4800,7 +4786,6 @@
|
||||||
C8B27B7E28153F2B00A22B5D /* Release */ = {
|
C8B27B7E28153F2B00A22B5D /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4821,7 +4806,6 @@
|
||||||
C8B27B8D28153F3100A22B5D /* Debug */ = {
|
C8B27B8D28153F3100A22B5D /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4842,7 +4826,6 @@
|
||||||
C8B27B8E28153F3100A22B5D /* Release - Debug */ = {
|
C8B27B8E28153F3100A22B5D /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4863,7 +4846,6 @@
|
||||||
C8B27B8F28153F3100A22B5D /* Release */ = {
|
C8B27B8F28153F3100A22B5D /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4884,7 +4866,6 @@
|
||||||
C8B27B9E28153F3400A22B5D /* Debug */ = {
|
C8B27B9E28153F3400A22B5D /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4905,7 +4886,6 @@
|
||||||
C8B27B9F28153F3400A22B5D /* Release - Debug */ = {
|
C8B27B9F28153F3400A22B5D /* Release - Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
@ -4926,7 +4906,6 @@
|
||||||
C8B27BA028153F3400A22B5D /* Release */ = {
|
C8B27BA028153F3400A22B5D /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
|
|
||||||
CLANG_CXX_LIBRARY = "libc++";
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
CLANG_ENABLE_OBJC_ARC = NO;
|
CLANG_ENABLE_OBJC_ARC = NO;
|
||||||
CODE_SIGN_IDENTITY = "-";
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
|
|
@ -350,7 +350,13 @@ void tr_peerIo::can_read_wrapper()
|
||||||
auto done = bool{ false };
|
auto done = bool{ false };
|
||||||
auto err = bool{ false };
|
auto err = bool{ false };
|
||||||
|
|
||||||
while (!done && !err)
|
// In normal conditions, only continue processing if we still have bandwidth
|
||||||
|
// quota for it.
|
||||||
|
//
|
||||||
|
// The read buffer will grow indefinitely if libutp or the TCP stack keeps buffering
|
||||||
|
// data faster than the bandwidth limit allows. To safeguard against that, we keep
|
||||||
|
// processing if the read buffer is more than twice as large as the target size.
|
||||||
|
while (!done && !err && (read_buffer_size() > RcvBuf * 2U || bandwidth().clamp(TR_DOWN, read_buffer_size()) != 0U))
|
||||||
{
|
{
|
||||||
size_t piece = 0;
|
size_t piece = 0;
|
||||||
auto const old_len = read_buffer_size();
|
auto const old_len = read_buffer_size();
|
||||||
|
@ -358,17 +364,14 @@ void tr_peerIo::can_read_wrapper()
|
||||||
auto const used = old_len - read_buffer_size();
|
auto const used = old_len - read_buffer_size();
|
||||||
auto const overhead = socket_.guess_packet_overhead(used);
|
auto const overhead = socket_.guess_packet_overhead(used);
|
||||||
|
|
||||||
if (piece != 0 || piece != used)
|
if (piece != 0)
|
||||||
{
|
{
|
||||||
if (piece != 0)
|
bandwidth().notifyBandwidthConsumed(TR_DOWN, piece, true, now);
|
||||||
{
|
}
|
||||||
bandwidth().notifyBandwidthConsumed(TR_DOWN, piece, true, now);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (used != piece)
|
if (used != piece)
|
||||||
{
|
{
|
||||||
bandwidth().notifyBandwidthConsumed(TR_DOWN, used - piece, false, now);
|
bandwidth().notifyBandwidthConsumed(TR_DOWN, used - piece, false, now);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overhead > 0)
|
if (overhead > 0)
|
||||||
|
@ -719,9 +722,19 @@ void tr_peerIo::utp_init([[maybe_unused]] struct_utp_context* ctx)
|
||||||
{
|
{
|
||||||
if (auto* const io = static_cast<tr_peerIo*>(utp_get_userdata(args->socket)); io != nullptr)
|
if (auto* const io = static_cast<tr_peerIo*>(utp_get_userdata(args->socket)); io != nullptr)
|
||||||
{
|
{
|
||||||
|
// The peer io object can destruct inside can_read_wrapper(), so keep
|
||||||
|
// it alive for the duration of this code block. This can happen when
|
||||||
|
// a BT handshake did not complete successfully for example.
|
||||||
|
auto const keep_alive = io->shared_from_this();
|
||||||
|
|
||||||
io->inbuf_.add(args->buf, args->len);
|
io->inbuf_.add(args->buf, args->len);
|
||||||
io->set_enabled(TR_DOWN, true);
|
io->set_enabled(TR_DOWN, true);
|
||||||
io->can_read_wrapper();
|
io->can_read_wrapper();
|
||||||
|
|
||||||
|
// utp_read_drained() notifies libutp that we read a packet from them.
|
||||||
|
// It opens up the congestion window by sending an ACK (soonish) if
|
||||||
|
// one was not going to be sent.
|
||||||
|
utp_read_drained(args->socket);
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
@ -733,16 +746,7 @@ void tr_peerIo::utp_init([[maybe_unused]] struct_utp_context* ctx)
|
||||||
{
|
{
|
||||||
if (auto const* const io = static_cast<tr_peerIo*>(utp_get_userdata(args->socket)); io != nullptr)
|
if (auto const* const io = static_cast<tr_peerIo*>(utp_get_userdata(args->socket)); io != nullptr)
|
||||||
{
|
{
|
||||||
// We use this callback to enforce speed limits by telling
|
return io->read_buffer_size();
|
||||||
// libutp to read no more than `target_dl_bytes` bytes.
|
|
||||||
auto const target_dl_bytes = io->bandwidth_.clamp(TR_DOWN, RcvBuf);
|
|
||||||
|
|
||||||
// libutp's private function get_rcv_window() allows libutp
|
|
||||||
// to read up to (UTP_RCVBUF - READ_BUFFER_SIZE) bytes and
|
|
||||||
// UTP_RCVBUF is set to `RcvBuf` by tr_peerIo::utp_init().
|
|
||||||
// So to limit dl to `target_dl_bytes`, we need to return
|
|
||||||
// N where (`target_dl_bytes` == RcvBuf - N).
|
|
||||||
return RcvBuf - target_dl_bytes;
|
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
|
@ -298,8 +298,10 @@ private:
|
||||||
filter_.encrypt(buflen, buf);
|
filter_.encrypt(buflen, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef WITH_UTP
|
||||||
void on_utp_state_change(int new_state);
|
void on_utp_state_change(int new_state);
|
||||||
void on_utp_error(int errcode);
|
void on_utp_error(int errcode);
|
||||||
|
#endif
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
|
|
@ -119,15 +119,9 @@ size_t tr_peer_socket::try_read(Buffer& buf, size_t max, tr_error** error) const
|
||||||
return buf.add_socket(handle.tcp, max, error);
|
return buf.add_socket(handle.tcp, max, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_UTP
|
// Unlike conventional BSD-style socket API, libutp pushes incoming data to the
|
||||||
// utp_read_drained() notifies libutp that this read buffer is empty.
|
// caller via a callback, instead of allowing the caller to pull data from
|
||||||
// It opens up the congestion window by sending an ACK (soonish) if
|
// its buffers. Therefore, reading data from a uTP socket is not handled here.
|
||||||
// one was not going to be sent.
|
|
||||||
if (is_utp() && std::empty(buf))
|
|
||||||
{
|
|
||||||
utp_read_drained(handle.utp);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c95738b1a6644b919e5b64d3ea9736cfc5894e0b
|
Subproject commit 52645d6d0fb16009e11d2f84469d2e43b7b6b48a
|
Loading…
Reference in New Issue