Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
b3b2bbe
Fix test suite when not root
jagerman Jun 29, 2025
e3b5a1b
Lokinet WIP
jagerman Jun 29, 2025
ddc2006
Add lokinet submodule properly
jagerman Jul 11, 2025
7494a1b
Drop duplicate submodules
jagerman Jul 11, 2025
e138f45
Add dummy test lokinet file
jagerman Jul 12, 2025
d82a7c7
Update lokinet to latest WIP with updated embedded build flags
jagerman Jul 12, 2025
15238e7
Build tweaks
jagerman Jul 14, 2025
b02fba5
WIP lokinet integration
mpretty-cyro Jul 15, 2025
359ddfb
More testing
mpretty-cyro Jul 15, 2025
fd75dc5
Rename the current session_network (to simplify refactoring)
mpretty-cyro Jul 15, 2025
eee85ba
Started breaking the session_network logic to be more configurable
mpretty-cyro Jul 18, 2025
8c09031
Further progress on refactoring, added first pass on QuicTransport
mpretty-cyro Jul 23, 2025
968a9a5
Initial work for the OnionRequestRouter, fixed some build errors
mpretty-cyro Jul 24, 2025
3074f09
Tweaked the snode pool logic to exclude based on /24 subnet
mpretty-cyro Jul 28, 2025
1652e4f
Added some logic for edge-case handling
mpretty-cyro Jul 29, 2025
f36f796
Further progress on refactored network
mpretty-cyro Jul 30, 2025
9a25efa
Fixed some bugs
mpretty-cyro Jul 31, 2025
789828f
Fixed up a few issues
mpretty-cyro Aug 1, 2025
a1b3298
Fixed a couple of deadlocks
mpretty-cyro Aug 5, 2025
88a97c9
Fixed general snode cache refresh, started on C interface
mpretty-cyro Aug 7, 2025
7938c70
Progressing the C interface somewhat
mpretty-cyro Aug 7, 2025
6b9347f
Added an option to use the legacy endpoint to refresh the cache
mpretty-cyro Aug 8, 2025
cef86a8
Fixed a couple of bugs
mpretty-cyro Aug 8, 2025
f975c44
Added error handling and bug fixes
mpretty-cyro Aug 18, 2025
577ea38
Added initial LokinetRouter wrapper
mpretty-cyro Aug 18, 2025
7990bef
Fixed a couple of bugs and cleaned up some duplicate code
mpretty-cyro Aug 18, 2025
f37c8eb
Fixed a few issues with the 421 retry mechanism
mpretty-cyro Aug 19, 2025
3c6c972
Added a number of remaining pieces of functionality from the old code
mpretty-cyro Aug 20, 2025
82a99c3
Started fixing recovery from network loss
mpretty-cyro Aug 21, 2025
2292a1d
Added suspend/resume funcs, fixed crash during destruction
mpretty-cyro Aug 27, 2025
6b94e54
Catch libQuic exception, handle missing opt, ran formatter
mpretty-cyro Aug 27, 2025
b38be2b
Removed an incorrect lock which was causing a deadlock
mpretty-cyro Aug 27, 2025
bda2d68
Resolved some TODOs
mpretty-cyro Aug 27, 2025
10806d2
Fixed a deadlock in the SnodePool
mpretty-cyro Aug 27, 2025
41baec0
Fixed a number of edge cases and bugs
mpretty-cyro Aug 28, 2025
32421ce
Fixed a couple of bugs in the SnodePool
mpretty-cyro Sep 3, 2025
6e2b4f3
Added function to retrieve the current connection status
mpretty-cyro Sep 7, 2025
f66a4bb
Updated to the latest lokinet
mpretty-cyro Sep 8, 2025
3f68176
Removed the old network code
mpretty-cyro Sep 8, 2025
2a162cd
Removed old header includes
mpretty-cyro Sep 8, 2025
47c50a6
Started looking at cleaning up the unit tests
mpretty-cyro Sep 8, 2025
14018c3
Fixed a few issues with the LokinetRouter
mpretty-cyro Sep 8, 2025
6c099c3
Fixed an issue where the lokinet payload is in a different format
mpretty-cyro Sep 10, 2025
b4e2982
Updated to latest Lokinet, added network info hook, removed '_v2'
mpretty-cyro Sep 17, 2025
e84eeb5
Changed an incorrect variable type
mpretty-cyro Sep 18, 2025
370e709
Started working on unit tests
mpretty-cyro Sep 18, 2025
e347230
Updated lokinet, bug fixing, unit test fixing
mpretty-cyro Sep 19, 2025
9c845f7
Cleanup network unit tests, fixed a few bugs which came up
mpretty-cyro Sep 22, 2025
3959c13
Added proxied requests to the LokinetRouter, fixed tests
mpretty-cyro Sep 22, 2025
c6eac5b
Merge remote-tracking branch 'upstream/dev' into feature/lokinet-testing
mpretty-cyro Sep 23, 2025
5ba9259
Ran formatter, try to fix CI builds
mpretty-cyro Sep 23, 2025
af2db94
Tweaks to tests to prevent unneeded calls
mpretty-cyro Sep 23, 2025
32fe271
Fixing errors found by CI
mpretty-cyro Sep 23, 2025
edc0067
Improved the robustness of a flaky test
mpretty-cyro Sep 23, 2025
d2848f1
Updated to the latest lokinet
mpretty-cyro Sep 23, 2025
ff31ee0
Swap Lokinet to session-path-refactor branch for testing
mpretty-cyro Sep 30, 2025
b8cf55c
Update to latest Lokinet
mpretty-cyro Oct 2, 2025
f19adfd
Updated to the latest lokinet
mpretty-cyro Oct 2, 2025
1a0820d
Fixed a crash which could occur during network destruction
mpretty-cyro Jan 7, 2026
199a61b
Addressed some PR comments, updated to Session Router, bug fixes
mpretty-cyro Jan 13, 2026
43463d0
More PR connects, IPv6 changes, non-JSON response handling, crash fix
mpretty-cyro Jan 15, 2026
45ad2a7
Updated to the latest Session Router to fix a build issue
mpretty-cyro Jan 15, 2026
7b51070
Updated code to use multiple quic streams, simplified some logic
mpretty-cyro Feb 3, 2026
bfb52ee
Remove 250ms timeout tick from RequestQueue
mpretty-cyro Feb 9, 2026
37cb815
Added code to persist snode strikes to disk
mpretty-cyro Feb 9, 2026
8d13805
Merge remote-tracking branch 'DoyleFork/dev' into feature/lokinet-tes…
mpretty-cyro Feb 9, 2026
595dca1
Cleaned up logging as per PR feedback
mpretty-cyro Feb 9, 2026
8b2fd2a
Fixed a crash which could occur after resetting the QUIC endpoint
mpretty-cyro Feb 10, 2026
7d4d2c9
Fixed an issue where using an explicit IPv6 address broke onion requests
mpretty-cyro Feb 10, 2026
961f2c3
Added code to load the snode strikes map from disk
mpretty-cyro Feb 10, 2026
08ef356
Updated the error handling to follow the new rules
mpretty-cyro Feb 12, 2026
18b82f5
Updated snode pool refresh to include nodes found in X responses
mpretty-cyro Feb 12, 2026
2053fcb
Updated clock resyncing logic
mpretty-cyro Feb 13, 2026
e69e55f
Reworked file I/O, added edge node cache and path/edge rotation
mpretty-cyro Feb 16, 2026
f8de7b4
Fixed edge node caching
mpretty-cyro Feb 16, 2026
320a63b
PR comments and feedback, steaming file interface
mpretty-cyro Feb 19, 2026
4cc33ae
fix fiddle_rlimit_nofile
jagerman Feb 19, 2026
d21e8b7
Rewrite date formatting using STL or HH date
jagerman Feb 19, 2026
fb1268b
parse_http_date: return more coarse sys_seconds
jagerman Feb 19, 2026
52a27e1
Adding missing exception
mpretty-cyro Feb 19, 2026
791c31b
Fix libc++ internal (from autocompletion, maybe?)
jagerman Feb 19, 2026
c3f6201
Optimize random base32 generator
jagerman Feb 20, 2026
2949111
Fixed a number of quick PR comments
mpretty-cyro Feb 20, 2026
bf8e236
Added the ability to specify the TTL when uploading a file
mpretty-cyro Feb 20, 2026
34b7696
Minor tweaks from testing
mpretty-cyro Feb 20, 2026
ba92b29
Replace DiskManager with dedicated quic::Loop
jagerman Feb 20, 2026
1cc32ba
fix base32 random generator
jagerman Feb 20, 2026
9a3ed8a
TOREWRITE: require loop, don't check
jagerman Feb 20, 2026
d9901e9
Fix resetting of clock resync internals
jagerman Feb 20, 2026
880e4df
Various code cleanups
jagerman Feb 21, 2026
8b5513a
get_service_nodes: use modern API
jagerman Feb 21, 2026
450238e
Bump session-router to fix embedded-only build linking error
jagerman Feb 21, 2026
311c409
Removed "callbacks" transport, added `desired_path_index` param
mpretty-cyro Feb 23, 2026
c31dc2b
Clean up fiddle_rlimit_nofile (now set_rlimit_nofile)
jagerman Feb 23, 2026
e28d64a
Bump session-router for another linking fix
jagerman Feb 23, 2026
258dd17
Added a function to expose whether the network offset has been set
mpretty-cyro Feb 24, 2026
52f10ce
Update clang and llvm version
Feb 9, 2026
ec7d627
Update to new STF repo URL + pubkey
jagerman Feb 24, 2026
5c8a09c
Fix clang-19 LTO linking
jagerman Feb 24, 2026
321f2a4
Bump session-router for more build fixes
jagerman Feb 24, 2026
930afe7
C++ modernization/optimizations
jagerman Feb 24, 2026
b07a6ed
fix clang LTO
jagerman Feb 24, 2026
59f6943
Minor cleanups
jagerman Feb 24, 2026
c20c657
Merge remote-tracking branch 'origin/dev' into feature/lokinet-testing
jagerman Feb 24, 2026
ad93e36
formatting
jagerman Feb 24, 2026
ed74fea
fix conflicting oxen::logging targets
jagerman Feb 24, 2026
5f0d1f4
Optimize fork_versions
jagerman Feb 25, 2026
bc36f06
another session-router build fix bump
jagerman Feb 25, 2026
762f33a
Allow disabling session-router but keeping quic + related fixes
jagerman Feb 25, 2026
3501fbb
yet another session-router build fix bump
jagerman Feb 25, 2026
a800c9e
Link to libevent properly
jagerman Feb 25, 2026
71e096e
session-router bump for android build fix
jagerman Feb 25, 2026
c2b7975
Added code to both parse and generate file server download urls
mpretty-cyro Feb 25, 2026
368119e
Updated upload/download requests to remove shared_ptr, cleanup C API
mpretty-cyro Feb 25, 2026
abce770
Dry out Upload/DownloadRequest with a base class of common members
jagerman Feb 25, 2026
37e94d3
Add and use chrono helpers
jagerman Feb 25, 2026
fef91d1
Simplify upload/download types
jagerman Feb 25, 2026
4602fde
Minor response parsing cleanups
jagerman Feb 25, 2026
58c94a2
Added test for download url parsing/generation and fixed a couple bugs
mpretty-cyro Feb 25, 2026
7d460e3
Added download url parsing/generation for open group servers as well
mpretty-cyro Feb 25, 2026
f9ec19e
Fixed a build error
mpretty-cyro Feb 25, 2026
576e570
Tweaks to download url generation
mpretty-cyro Feb 26, 2026
be2b98d
Added more distinct errors
mpretty-cyro Feb 26, 2026
daf38ee
Cleanup weak_self and this usage
mpretty-cyro Feb 26, 2026
25b987e
Removed unneeded std::move calls for disk writing
mpretty-cyro Feb 26, 2026
b30cf08
Removed redundant "safety" reservation
mpretty-cyro Feb 26, 2026
c81d823
Addressed a bunch of PR comments
mpretty-cyro Feb 26, 2026
2c37e94
Fixed a potential collision issue with the random request ids
mpretty-cyro Feb 26, 2026
0255d7e
Joining upload threads during destruction, added missing OR clear cache
mpretty-cyro Feb 26, 2026
eb94c72
Updated `session_file_metadata` to also have a 64 char id
mpretty-cyro Feb 26, 2026
b84d62f
Add missing header
jagerman Feb 26, 2026
ed12685
Cleaned up url parsing, added 'extend' file server request
mpretty-cyro Feb 26, 2026
c6ecbd4
Removed snode pool legacy endpoint refresh logic
mpretty-cyro Feb 26, 2026
42b3669
Added static node list fallback logic after failing to bootstrap from…
mpretty-cyro Feb 27, 2026
a9753ac
Drop compute_message_hash
jagerman Feb 27, 2026
d9fd399
Updated to the latest session router
mpretty-cyro Feb 27, 2026
ab57da6
Fixed build issues and log tweaks
mpretty-cyro Feb 27, 2026
f58a4eb
Ran linter
mpretty-cyro Feb 27, 2026
5990a90
Fixed a couple of issues with shutting down the network
mpretty-cyro Mar 2, 2026
24f4acb
Fixed a couple of bugs with file uploads
mpretty-cyro Mar 2, 2026
b6b1473
Fixed a crash due to an invalidated iterator
mpretty-cyro Mar 2, 2026
a3b23df
Added missing import
mpretty-cyro Mar 3, 2026
bd9ac35
Fix CI build errors
mpretty-cyro Mar 3, 2026
4340260
Merge remote-tracking branch 'upstream/dev' into feature/lokinet-testing
mpretty-cyro Mar 3, 2026
462d332
Removed the `max_streams` setting, added available_stream_ids pool
mpretty-cyro Mar 4, 2026
8f1fbc1
Fixed a crash when incorrectly erasing a joinable thread
mpretty-cyro Mar 4, 2026
563bc0e
Fixed some misleading errors
mpretty-cyro Mar 4, 2026
70cc271
Code review tweaks
mpretty-cyro Mar 4, 2026
48111fb
Fixed a crash which could occur when the network is destroyed
mpretty-cyro Mar 4, 2026
9be760d
Merge remote-tracking branch 'upstream/dev' into feature/lokinet-testing
mpretty-cyro Mar 4, 2026
c3479e9
Increased some version numbers
mpretty-cyro Mar 5, 2026
edc00b1
Updated to the latest Session Router
mpretty-cyro Mar 5, 2026
3266023
Debugging logging test failures
mpretty-cyro Mar 5, 2026
bfba2e0
Tweak logging test to be less specific
mpretty-cyro Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ local debian_backports(distro, pkgs) = [
'eatmydata ' + apt_get_quiet + ' install -y ' + std.join(' ', std.map(function(x) x + '/' + distro + '-backports', pkgs)),
];

local add_stf_repo(image) = [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp utils/deb.session.foundation.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.session.foundation ' + (if std.startsWith(image, docker_base + 'debian-sid') then 'sid' else '$$(lsb_release -sc)') + ' main >/etc/apt/sources.list.d/session.list',
'eatmydata ' + apt_get_quiet + ' update',
];

// Do something on a debian-like system
local debian_pipeline(name,
image,
arch='amd64',
deps=default_deps,
oxen_repo=true,
stf_repo=true,
kitware_repo=''/* ubuntu codename, if wanted */,
allow_fail=false,
cmake_pkg='cmake',
Expand All @@ -62,12 +69,7 @@ local debian_pipeline(name,
apt_get_quiet + ' update',
apt_get_quiet + ' install -y eatmydata',
] + (
if oxen_repo then [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp utils/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
'eatmydata ' + apt_get_quiet + ' update',
] else []
if stf_repo then add_stf_repo(image) else []
) + (
if kitware_repo != '' then [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y curl ca-certificates',
Expand Down Expand Up @@ -97,7 +99,7 @@ local debian_build(name,
shared_libs=true,
jobs=6,
tests=true,
oxen_repo=true,
stf_repo=true,
kitware_repo=''/* ubuntu codename, if wanted */,
extra_setup=[],
allow_fail=false)
Expand All @@ -106,7 +108,7 @@ local debian_build(name,
image,
arch=arch,
deps=deps,
oxen_repo=oxen_repo,
stf_repo=stf_repo,
kitware_repo=kitware_repo,
allow_fail=allow_fail,
build=[
Expand All @@ -116,6 +118,7 @@ local debian_build(name,
(if werror then '-DWARNINGS_AS_ERRORS=ON ' else '') +
(if shared_libs then '-DBUILD_SHARED_LIBS=ON ' else '') +
'-DUSE_LTO=' + (if lto then 'ON ' else 'OFF ') +
'-DWITH_LTO=' + (if lto then 'ON ' else 'OFF ') +
'-DWITH_TESTS=' + (if tests then 'ON ' else 'OFF ') +
cmake_extra +
ci_dep_mirror(local_mirror),
Expand All @@ -131,11 +134,7 @@ local debian_build(name,
commands:
[apt_get_quiet + ' install -y eatmydata'] + (
if std.length(test_deps) > 0 then (
if oxen_repo then [
'eatmydata ' + apt_get_quiet + ' install --no-install-recommends -y lsb-release',
'cp utils/deb.oxen.io.gpg /etc/apt/trusted.gpg.d',
'echo deb http://deb.oxen.io $$(lsb_release -sc) main >/etc/apt/sources.list.d/oxen.list',
] else []
if stf_repo then add_stf_repo(image) else []
) + [
'eatmydata ' + apt_get_quiet + ' update',
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
Expand Down Expand Up @@ -287,7 +286,7 @@ local static_build(name,
build_type='Release',
lto=true,
deps=default_deps,
oxen_repo=false,
stf_repo=false,
kitware_repo=''/* ubuntu codename, if wanted */,
cmake_extra='',
local_mirror=true,
Expand All @@ -298,7 +297,7 @@ local static_build(name,
image,
arch=arch,
deps=deps,
oxen_repo=oxen_repo,
stf_repo=stf_repo,
allow_fail=allow_fail,
build=[
'export JOBS=' + jobs,
Expand Down Expand Up @@ -379,7 +378,7 @@ local static_build(name,
docker_base + 'debian-win32-cross',
'libsession-util-windows-x64-TAG.zip',
deps=['g++-mingw-w64-x86-64-posix'],
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-x86-64-toolchain.cmake'),
cmake_extra='-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-x86-64-toolchain.cmake -DENABLE_NETWORKING_SROUTER=OFF'),
/* currently broken:
static_build('Static Windows x86',
docker_base + 'debian-win32-cross',
Expand Down
15 changes: 6 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@
[submodule "external/zstd"]
path = external/zstd
url = https://github.com/facebook/zstd.git
[submodule "external/nlohmann-json"]
path = external/nlohmann-json
url = https://github.com/nlohmann/json.git
[submodule "external/oxen-libquic"]
path = external/oxen-libquic
url = https://github.com/oxen-io/oxen-libquic.git
[submodule "external/protobuf"]
path = external/protobuf
url = https://github.com/protocolbuffers/protobuf.git
[submodule "external/oxen-logging"]
path = external/oxen-logging
url = https://github.com/oxen-io/oxen-logging.git
[submodule "external/session-router"]
path = external/session-router
url = https://github.com/session-foundation/session-router.git
[submodule "external/simdutf"]
path = external/simdutf
url = https://github.com/simdutf/simdutf.git
[submodule "external/date"]
path = external/date
url = https://github.com/HowardHinnant/date.git
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(CCACHE_PROGRAM)
endif()

project(libsession-util
VERSION 1.5.10
VERSION 1.6.0
DESCRIPTION "Session client utility library"
LANGUAGES ${LANGS})

Expand Down Expand Up @@ -82,7 +82,8 @@ option(STATIC_LIBSTD "Statically link libstdc++/libgcc" ${default_static_libstd}
option(USE_LTO "Use Link-Time Optimization" ${use_lto_default})

# Provide this as an option for now because GMP and Desktop are sometimes unhappy with each other.
option(ENABLE_ONIONREQ "Build with onion request functionality" ON)
option(ENABLE_NETWORKING "Build with networking functionality" ON)
option(ENABLE_NETWORKING_SROUTER "Build with session-router networking support (requires ENABLE_NETWORKING)" ON)

if(USE_LTO)
include(CheckIPOSupported)
Expand Down Expand Up @@ -119,7 +120,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

add_subdirectory(external)

if(ENABLE_ONIONREQ)
if(ENABLE_NETWORKING)
if(NOT TARGET nettle::nettle)
if(BUILD_STATIC_DEPS)
message(FATAL_ERROR "Internal error: nettle::nettle target (expected via libquic BUILD_STATIC_DEPS) not found")
Expand Down
113 changes: 67 additions & 46 deletions external/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
option(SUBMODULE_CHECK "Enables checking that vendored library submodules are up to date" ON)

if(SUBMODULE_CHECK)
find_package(Git)
if(GIT_FOUND)
Expand Down Expand Up @@ -26,39 +27,41 @@ if(SUBMODULE_CHECK)
message(STATUS "Checking submodules")
check_submodule(ios-cmake)
check_submodule(libsodium-internal)
check_submodule(oxen-libquic external/oxen-logging external/oxen-encoding)
check_submodule(nlohmann-json)
check_submodule(zstd)
check_submodule(protobuf)
check_submodule(session-router)
check_submodule(date)
endif()
endif()

if(NOT BUILD_STATIC_DEPS AND NOT FORCE_ALL_SUBMODULES)
find_package(PkgConfig REQUIRED)
endif()

macro(libsession_system_or_submodule BIGNAME smallname pkgconf subdir)
option(FORCE_${BIGNAME}_SUBMODULE "force using ${smallname} submodule" OFF)
if(NOT BUILD_STATIC_DEPS AND NOT FORCE_${BIGNAME}_SUBMODULE AND NOT FORCE_ALL_SUBMODULES)
pkg_check_modules(${BIGNAME} ${pkgconf} IMPORTED_TARGET GLOBAL)
endif()
if(${BIGNAME}_FOUND)
add_library(${smallname} INTERFACE IMPORTED GLOBAL)
if(NOT TARGET PkgConfig::${BIGNAME} AND CMAKE_VERSION VERSION_LESS "3.21")
# Work around cmake bug 22180 (PkgConfig::THING not set if no flags needed)
macro(libsession_system_or_submodule BIGNAME smallname target pkgconf subdir)
if(NOT TARGET ${target})
option(FORCE_${BIGNAME}_SUBMODULE "force using ${smallname} submodule" OFF)
if(NOT BUILD_STATIC_DEPS AND NOT FORCE_${BIGNAME}_SUBMODULE AND NOT FORCE_ALL_SUBMODULES)
pkg_check_modules(${BIGNAME} ${pkgconf} IMPORTED_TARGET GLOBAL)
endif()
if(${BIGNAME}_FOUND)
add_library(${smallname} INTERFACE IMPORTED GLOBAL)
if(NOT TARGET PkgConfig::${BIGNAME} AND CMAKE_VERSION VERSION_LESS "3.21")
# Work around cmake bug 22180 (PkgConfig::THING not set if no flags needed)
else()
target_link_libraries(${smallname} INTERFACE PkgConfig::${BIGNAME})
endif()
message(STATUS "Found system ${smallname} ${${BIGNAME}_VERSION}")
else()
target_link_libraries(${smallname} INTERFACE PkgConfig::${BIGNAME})
message(STATUS "using ${smallname} submodule ${subdir}")
add_subdirectory(${subdir})
endif()
message(STATUS "Found system ${smallname} ${${BIGNAME}_VERSION}")
else()
message(STATUS "using ${smallname} submodule")
add_subdirectory(${subdir})
endif()
if(TARGET ${smallname} AND NOT TARGET ${smallname}::${smallname})
add_library(${smallname}::${smallname} ALIAS ${smallname})
endif()
if(BUILD_STATIC_DEPS AND STATIC_BUNDLE)
if(NOT TARGET ${target})
add_library(${target} ALIAS ${smallname})
endif()
if(BUILD_STATIC_DEPS AND STATIC_BUNDLE)
libsession_static_bundle(${smallname}::${smallname})
endif()
endif()
endmacro()

Expand Down Expand Up @@ -100,31 +103,27 @@ if(CMAKE_CROSSCOMPILING)
endif()
endif()

set(LIBQUIC_BUILD_TESTS OFF CACHE BOOL "")
if(ENABLE_ONIONREQ)
libsession_system_or_submodule(OXENQUIC quic liboxenquic>=1.3.0 oxen-libquic)
if(ENABLE_NETWORKING)
set(LIBQUIC_BUILD_TESTS OFF CACHE BOOL "")
libsession_system_or_submodule(OXENQUIC quic oxen::quic liboxenquic>=1.8 session-router/external/oxen-libquic)
endif()

if(NOT TARGET oxenc::oxenc)
# The oxenc target will already exist if we load libquic above via submodule
set(OXENC_BUILD_TESTS OFF CACHE BOOL "")
set(OXENC_BUILD_DOCS OFF CACHE BOOL "")
libsession_system_or_submodule(OXENC oxenc liboxenc>=1.3.0 oxen-libquic/external/oxen-encoding)
endif()
libsession_system_or_submodule(OXENC oxenc oxenc::oxenc liboxenc>=1.5.0 session-router/external/oxen-libquic/external/oxen-encoding)

libsession_system_or_submodule(OXENLOGGING oxenlogging oxen::logging liboxen-logging>=1.2.0 session-router/external/oxen-libquic/external/oxen-logging)
if(OXENLOGGING_FOUND)
if(NOT TARGET oxen::logging)
# If we load oxen-logging via system lib then we won't necessarily have fmt/spdlog targets,
# but this script will give us them:
include(session-router/external/oxen-libquic/external/oxen-logging/cmake/load_fmt_spdlog.cmake)

if(NOT TARGET oxen::logging)
add_subdirectory(oxen-libquic/external/oxen-logging)
add_library(oxen-logging-fmt-spdlog INTERFACE)
target_link_libraries(oxen-logging-fmt-spdlog INTERFACE oxenlogging::oxenlogging ${OXEN_LOGGING_FMT_TARGET} ${OXEN_LOGGING_SPDLOG_TARGET})
add_library(oxen::logging ALIAS oxen-logging-fmt-spdlog)
endif()
endif()

oxen_logging_add_source_dir("${PROJECT_SOURCE_DIR}")

# Apple xcode 15 has a completely broken std::source_location; we can't fix it, but at least we can
# hack up the source locations to hide the path that it uses (which is the useless path to
# oxen/log.hpp where the info/critical/etc. bodies are).
if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL AppleClang AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 16)
message(WARNING "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} is broken: filenames in logging statements will not display properly")
oxen_logging_add_source_dir("${CMAKE_CURRENT_SOURCE_DIR}/oxen-libquic/external/oxen-logging/include/oxen")
endif()

if(CMAKE_C_COMPILER_LAUNCHER)
set(deps_cc "${CMAKE_C_COMPILER_LAUNCHER} ${deps_cc}")
Expand All @@ -144,12 +143,12 @@ if(APPLE)
endforeach()
endif()


function(libsodium_internal_subdir)
function(add_static_subdirectory dir)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(libsodium-internal)
add_subdirectory(${dir} ${ARGN})
endfunction()
libsodium_internal_subdir()

add_static_subdirectory(libsodium-internal)
libsession_static_bundle(libsodium::sodium-internal)


Expand All @@ -163,7 +162,7 @@ set(protobuf_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(protobuf_ABSL_PROVIDER "module" CACHE STRING "" FORCE)
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "")
set(protobuf_BUILD_PROTOBUF_BINARIES ON CACHE BOOL "" FORCE)
libsession_system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf-lite>=3.21 protobuf)
libsession_system_or_submodule(PROTOBUF_LITE protobuf_lite protobuf::libprotobuf-lite protobuf-lite>=3.21 protobuf)
if(TARGET PkgConfig::PROTOBUF_LITE AND NOT TARGET protobuf::libprotobuf-lite)
add_library(protobuf::libprotobuf-lite ALIAS PkgConfig::PROTOBUF_LITE)
endif()
Expand Down Expand Up @@ -192,7 +191,19 @@ libsession_static_bundle(libzstd_static)

set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install ON CACHE INTERNAL "") # Required to export targets that we use
libsession_system_or_submodule(NLOHMANN nlohmann_json nlohmann_json>=3.7.0 nlohmann-json)
libsession_system_or_submodule(NLOHMANN nlohmann_json nlohmann_json::nlohmann_json nlohmann_json>=3.7.0 session-router/external/nlohmann)

if(ENABLE_NETWORKING AND ENABLE_NETWORKING_SROUTER)
set(SROUTER_FULL OFF CACHE BOOL "")
set(SROUTER_DAEMON OFF CACHE BOOL "")
set(SROUTER_NATIVE_BUILD OFF CACHE BOOL "")
set(SROUTER_JEMALLOC OFF CACHE BOOL "")

add_library(sodium INTERFACE)
target_link_libraries(sodium INTERFACE libsodium::sodium-internal)
add_static_subdirectory(session-router EXCLUDE_FROM_ALL)
libsession_static_bundle(session-router::libsessionrouter)
endif()

set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install ON CACHE INTERNAL "") # Required to export targets that we use
Expand All @@ -205,3 +216,13 @@ function(simdutf_subdir)
endfunction()
simdutf_subdir()
libsession_static_bundle(simdutf)

# We need Howard Hinnant's header-only date library for now because the STL implementation of
# std::chrono::parse() is spotty or broken on:
# - Apple. libc++ date parsing is only available when on XCode 16.3+ *and* targetting macOS 15+.
# - gcc before 13.
# - clang+libc++ before llvm-19. (Real 19, not Apple's idiotic PR renumbering).
#
# On the plus side, this is header-only so we don't actually compile anything extra if we don't
# actually use it.
add_subdirectory(date)
1 change: 1 addition & 0 deletions external/date
Submodule date added at 45d454
1 change: 0 additions & 1 deletion external/nlohmann-json
Submodule nlohmann-json deleted from 9cca28
1 change: 0 additions & 1 deletion external/oxen-libquic
Submodule oxen-libquic deleted from 793bf5
1 change: 0 additions & 1 deletion external/oxen-logging
Submodule oxen-logging deleted from 6ae91a
1 change: 1 addition & 0 deletions external/session-router
Submodule session-router added at d2def4
2 changes: 1 addition & 1 deletion include/session/config/convo_info_volatile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace convo {

/// Unix epoch timestamp to which this proof's entitlement to Session Pro features is valid
/// to
std::chrono::sys_time<std::chrono::milliseconds> pro_expiry_unix_ts{};
sys_ms pro_expiry_unix_ts{};

protected:
using base::base;
Expand Down
4 changes: 2 additions & 2 deletions include/session/config/user_profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ class UserProfile : public ConfigBase {
/// Inputs: None
///
/// Outputs:
/// - `std::optional<std::chrono::sys_time<std::chrono::milliseconds>>` - The unix timestamp in
/// - `std::optional<sys_ms>` - The unix timestamp in
/// milliseconds that the users pro access will expire, or nullopt if unset.
std::optional<std::chrono::sys_time<std::chrono::milliseconds>> get_pro_access_expiry() const;
std::optional<sys_ms> get_pro_access_expiry() const;

/// API: user_profile/UserProfile::set_pro_access_expiry
///
Expand Down
5 changes: 3 additions & 2 deletions include/session/file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <iosfwd>
#include <string>
#include <string_view>
#include <vector>

// Utility functions for working with files

Expand All @@ -19,8 +20,8 @@ std::ofstream open_for_writing(const fs::path& filename);
/// enabled for any failures. This also throws if the file cannot be opened.
std::ifstream open_for_reading(const fs::path& filename);

/// Reads a (binary) file from disk into the string `contents`.
std::string read_whole_file(const fs::path& filename);
/// Reads a (binary) file from disk.
std::vector<std::byte> read_whole_file(const fs::path& filename);

/// Dumps (binary) string contents to disk. The file is overwritten if it already exists.
void write_whole_file(const fs::path& filename, std::string_view contents = "");
Expand Down
Loading